MongoDatabase Class
MongoDatabase API.
Constructor
MongoDatabase
(
-
Database
Parameters:
-
Database
Object
Item Index
Properties
Methods
collectionExists
(
Boolean
-
collectionName
Checks to see if a collection exists
Parameters:
-
collectionName
StringThe collection to test for existence
Returns:
Boolean:
false if no collection by that name exists, true if a match to an existing collection was found
createCollection
(
-
name
-
[options]
Creates a collection with a given name and options.
Parameters:
-
name
Stringthe name of the collection to return
-
[options]
Object optionaloptions (See official documentation)
dropDatabase
()
Drops this database
getCollection
(
MongoCollection
-
name
Gets a collection with a given name. If the collection does not exist, a new collection is created.
Parameters:
-
name
Stringthe name of the collection to return
Returns:
MongoCollection:
the collection
getCollectionNames
()
Array
Returns a set containing the names of all collections in this database
Returns:
Array:
the names of collections in this database
Properties
name
String
Database name