Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

native-mongo-util

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

native-mongo-util - npm Package Compare versions

Comparing version 2.2.0 to 2.2.1

2

package.json
{
"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.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc