mongodb-interaction v1.0.1
mongodb-interaction
I'm trying stuff with MongoDB, and I'm using this so I don't need to rewrite stuff next time :)
Functions
createClient()
Create a MongoDB client. Parameter(s): {String} uri - The MongoDB URI to connect to Returns: MongoClient
connect()
Connect to MongoDB database with client created with createClient() Parameter(s): {MongoClient} client - Client to connect with {Function} afterConnection - What to do after connection Returns: Nothing
getDatabase()
Get a database. Parameter(s): {MongoClient} client - Connected client {String} databaseName - Name of desired database Returns: Database
getCollection()
Get a collection from a database. Parameter(s): {Database} database - Database to get collection from {String} collectionName - Name of desired collection Returns: Collection
getCollectionFromDatabase()
Mix of getDatabase() and getCollection() Parameter(s): {MongoClient} client - Connected client {String} databaseName - Name of database to get collection from {String} collectionName - Name of desired collection Returns: Collection