Question

I have a meteor server running on my localhost port 3000. I want to connect to its mongodb using an objective C app. So far I have been unable to connect, but I believe that I have installed ObjCMongodb correctly into my project following the steps listed in the README. I use the ObjCMongodb line of code to connect MongoConnection *dbConn = [MongoConnection connectionForServer:@"127.0.0.1:3000" error:&error]; where 3000 is the port where the meteor application is running. One of my mongodb collection's is called 'messages' so I use MongoDBCollection *collection = [dbConn collectionWithName:@"messages"]; I try to do various commands as stated in the README, however none of them work. I know it must be the connection to the server that is making it fail or improper installation. Thanks for the help.

Was it helpful?

Solution

In order to access my meteor mondgodb database I used the ObjCMongodb package here. The following code was then used as stated in the ReadMe to connect to the meteor app running on the localhost.

MongoConnection *dbConn = [MongoConnection connectionForServer:@"127.0.0.1:3002" error:&error];
MongoDBCollection *collection = [dbConn collectionWithName:@"meteor.messages"];

Where the port was 3000, but the mondgodb was +2 making it port 3002. The collectionWithName was then meteor.(my collection wanting to be accessed). Special thanks to noa and Akshat.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top