Collection and Client getters
Utility functions for global access to Collections and MongoClient.
getCollection(name [, options]) => Collection
typescript
getCollection(name [, options]) => CollectionGet a new instance of a collection. Uses default database determined from the connection string. See official driver documentation for valid options.
typescript
import { getCollection } from 'mongodash';
const myCollection = getCollection('myCollectionName');The method just shortens getMongoClient().db().collection('myCollectionName').
getMongoClient() => MongoClient
typescript
getMongoClient() => MongoClientReturns the global instance of MongoClient. See official driver documentation for documentation of MongoClient.
typescript
import { getMongoClient } from 'mongodash';
const mongoClient = getMongoClient();