Nodejs Object-Oriented MongoDB Manager
Connects to the mongo database with the given uri and databaseName.
Parameters| Name | 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().
Throws| Error 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().
Parameters| Name | Type | Description |
|---|---|---|
| hexString | String | A 24 byte hex string. |
mongodb.ObjectId - A native mongo ObjectId object.
Throws| Error Type | Cause |
|---|---|
| MongoError | If given hexString is invalid. |