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.0.0 to 2.0.1

14

index.js

@@ -69,8 +69,18 @@ const Log = require('lil-logger').getLogger(__filename);

promiseLibrary: Promise,
loggerLevel: 'error',
loggerLevel: 'info',
useNewUrlParser: true
}
);
this._db = this._client.db();
Log.debug({ msg: `DB connected: ${exports.getDBName()}` });
this._db.on('close', () => {
Log.debug({ msg: `DB lost connection: ${this.getDBName()}` });
});
this._db.on('reconnect', () => {
Log.debug({ msg: `DB reconnected: ${this.getDBName()}` });
});
Log.debug({ msg: `DB connected: ${this.getDBName()}` });
this.isConnecting = false;

@@ -77,0 +87,0 @@ }

2

package.json
{
"name": "native-mongo-util",
"version": "2.0.0",
"version": "2.0.1",
"description": "",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -0,1 +1,3 @@

process.env.MONGO_URL = 'mongodb://localhost/testDB';
import test from 'ava';

@@ -6,11 +8,10 @@ const { getDBName, connect, getCollection, newConnection } = require('./');

const dbName = getDBName();
t.is(dbName, 'test');
t.is(dbName, 'testDB');
});
test.serial('fetch all records from a collection', async t => {
const a = await getCollection('testCol')
.find()
.toArray();
t.is(a.length, 0);
const d = Date.now();
await getCollection('testCol').insert({ d });
const a = await getCollection('testCol').findOne({ d });
t.truthy(a, 'Doc not saved');
});

@@ -26,8 +27,6 @@

const a = await connection
.getCollection('testCol')
.find()
.toArray();
t.is(a.length, 0);
const d = Date.now();
await connection.getCollection('someCol').insert({ d });
const a = await connection.getCollection('someCol').findOne({ d });
t.truthy(a, 'Doc not saved');
});
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