native-mongo-util
Advanced tools
Comparing version 2.2.0 to 2.2.1
{ | ||
"name": "native-mongo-util", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -20,3 +20,3 @@ # native-mongo-util | ||
try { | ||
await connect(); // connect to db | ||
await connect({ poolSize: 20 }); // connect to db with options to MongoClient | ||
@@ -41,3 +41,3 @@ const userCollection = getCollection('user'); | ||
const mongoURL = 'mongodb://localhost/someOtherDB'; | ||
const connection = newConnection(mongoURL); | ||
const connection = newConnection(mongoURL, { poolSize: 20 }); // Provide mongo uri & MongoClient options | ||
await connection.connect(); // connect to someOtherDB | ||
@@ -58,4 +58,4 @@ | ||
- `exports.newConnection(mongoURL)` Function will create & return new `Connection` class instance. `mongoURL` is valid mongodb connection string. | ||
- `async exports.connect()` Async function that connects to mongodb, using `MONGO_URL` env var. Returns Mongodb `DB` class instance | ||
- `exports.newConnection(mongoURL, options)` Function will create & return new `Connection` class instance. `mongoURL` is valid mongodb connection string. `options` is MongoClient options | ||
- `async exports.connect(options)` Async function that connects to mongodb, using `MONGO_URL` env var. MongoClient `options` can also be passed. Returns Mongodb `DB` class instance | ||
- `exports.getCollection(collectionName)` Returns Mongodb collection (`Collection` instance) for `collectionName`. | ||
@@ -66,3 +66,3 @@ - `async exports.getClient()` Returns Mongodb `MongoClient` class instance | ||
- Class **Connection** methods | ||
- `constructor(mongoURL)` Valid mongodb connection string | ||
- `constructor(mongoURL, options)` Valid mongodb connection string and MongoClient options | ||
- `async connect()` Async method connects to mongodb, using `mongoURL` for the same instance. Returns Mongodb `DB` class instance | ||
@@ -69,0 +69,0 @@ - `getCollection(collectionName)` Returns mongodb collection. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10588