mongo-async
A simple MongoDB client manager compatible with async/await functions.
Usage
Connecting to MongoDB from an async function:
;const mongoUrl = 'mongodb://localhost/mydb' { let db = await mongo; // do something with the db}
Connecting to MongoDB outside of an async function:
;const mongoUrl = 'mongodb://localhost/mydb' mongo ;
Using a database:
; { let db = await mongo; // do stuff with db}
Or using a collection:
; { let collection = await mongo; // do stuff with collection}
Future enhancements...
- Make connect idempodent
- await for db/collection methods that resolve when the connection has been established