Database commands
db.createCollection( STRING *collectionName*
)
Creates a collection with the specified name. Strings are surrounded by double qoutes. For example:db.createCollection("identities");
The String = "true" when the database is created. If the command fails, an error is raised.
db.listCollectionNames( )
Lists the names of the collections in the selected database.
An output row for each collection in the database with the result field containing the String name of the collection.
db.listCollections( )
Lists collection details of all collections in the selected database.
An output row for each collection in the database with the result field containing a BSON document with collection details.
db.runCommand( BSON *command*
)
Runs a command on the selected database. See db.runCommand for details on a similar shell command. For example: db.runCommand( { find : "identities", projection : { superhero : 1, _id : 0 } } );
An output row containing with the result field containing a BSON document of command results.
Last updated
Was this helpful?