Database is an event emitter that emits the following events:
error
- Emitted if there is an error during connection with the error as its argumentconnect
- Emitted once the connection has been establishedclose
- Emitted when the connection is forcibly closed
Each instance of Database has the following properties:
ObjectId
- Constructor for making ObjectIds from strings
Returns Collection
Get a collection by name
Returns Promise<void>
Close the database connection
Returns Promise<any>
Execute a command
Returns Promise<Array<Object>>
Get a list of collections with info about each one
Returns Promise<Array<string>>
Get a list of all the collections
Returns Promise<void>
Create a collection by name
Returns Promise<Object>
Returns Promise<void>
Returns Promise<void>
Returns Promise<void>
Returns Promise<any>
Returns Promise<Object>
Returns Promise<string>
Returns string
Returns Promise