Skip to content

Commit

Permalink
simple connect method for local MongoDB databases.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Burks committed Oct 10, 2010
1 parent 4eeb661 commit af6dfc4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions objc/NuMongoDB.h
Expand Up @@ -61,6 +61,8 @@ limitations under the License.

/*! Connect to a MongoDB database. Options can include @"host" and @"port". */
- (int) connectWithOptions:(NSDictionary *) options;
/*! Connect to a local MongoDB database on the default port (27017). */
- (int) connect;
/*! Add user to named database. */
- (void) addUser:(NSString *) user withPassword:(NSString *) password forDatabase:(NSString *) database;
/*! Authenticate to named database. */
Expand Down
4 changes: 4 additions & 0 deletions objc/NuMongoDB.m
Expand Up @@ -92,6 +92,10 @@ - (int) connectWithOptions:(NSDictionary *) options
return mongo_connect(conn, &opts);
}

- (int) connect {
return [self connectWithOptions:nil];
}

- (void) addUser:(NSString *) user withPassword:(NSString *) password forDatabase:(NSString *) database
{
mongo_cmd_add_user(conn, [database cStringUsingEncoding:NSUTF8StringEncoding],
Expand Down

0 comments on commit af6dfc4

Please sign in to comment.