I'm very new to use ObjCMongoDB; I need to connect to a mongoDB from inside my application so I'm trying to integrate ObjCMongoDB.framework into my project.
I've read the wiki and I didn't find any reference on connecting to a DB with username and password. Maybe I didn't look into enough but the only suggested example of connection is the following:
MongoConnection *dbConn = [MongoConnection connectionForServer:@"127.0.0.1" error:&error];
with no user and no pwd.
Did anyone get into the same problem or is there a method that could be useful? I found that in mongo.c there is mongo_cmd_authenticate
but I don't know how to use it.
Any suggestion is really appreciated.
As of this pull request the driver has support for authentication.
NSError *error = nil;
[connection authenticate:@"mydb" username:@"user" password:@"password" error:&error];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.