Nodejs Object-Oriented MongoDB Manager
Connects to the mongo database with the given uri and databaseName.
ParametersName | Type | Description |
---|---|---|
uri | String | A uri string of the database to connect to. |
databaseName | String | The name of the database to connect to. |
Promise<mongodb.Db> - The database object returned by mongodb.MongoClient.connect().
ThrowsError Type | Cause |
---|---|
NoommanDatabaseError | If an attempt is made to connect to a database more than once without calling close(). |
MongoError | If underlying call to mongodb.MongoCLient.connect() throws an error. |
Closes the connection to a mongo db that was established by calling connect().
ReturnsPromise<undefined> - A promise which will resolve undefined if connection is closed successfully.
Use to determine if a connection to a database is active.
ReturnsBoolean - True if connection to database is active, false otherwise.
Creates a new ObjectId either from the given hexString or by calling new mongodb.ObjectId().
ParametersName | Type | Description |
---|---|---|
hexString | String | A 24 byte hex string. |
mongodb.ObjectId - A native mongo ObjectId object.
ThrowsError Type | Cause |
---|---|
MongoError | If given hexString is invalid. |