Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions objc/NuMongoDB.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ limitations under the License.
- (id) runCommand:(id) command inDatabase:(NSString *) database;
/*! Get the names of the collections in a database. */
- (id) collectionNamesInDatabase:(NSString *) database;
/*! Convenience method to list all the databases on the connected server. */
- (id) listDatabases;
/*! Remove a database. */
- (BOOL) dropDatabase:(NSString *) database;
/*! Remove a collection. */
Expand Down
5 changes: 5 additions & 0 deletions objc/NuMongoDB.m
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,11 @@ - (id) collectionNamesInDatabase:(NSString *) database
return result;
}

- (id) listDatabases
{
return [self runCommand:[NSDictionary dictionaryWithObject:@"1" forKey:@"listDatabases"] inDatabase:@"admin"];
}

- (BOOL) ensureCollection:(NSString *) collection hasIndex:(NSObject *) key withOptions:(int) options
{
bson output;
Expand Down