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

nedb

Package Overview
Dependencies
Maintainers
1
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nedb - npm Package Compare versions

Comparing version 0.11.0 to 0.11.1

105

browser-version/test/nedb-browser.js

@@ -9,3 +9,2 @@ /**

var assert = chai.assert;
chai.should();

@@ -25,4 +24,4 @@ /**

db.inMemoryOnly.should.equal(true);
db.persistence.inMemoryOnly.should.equal(true);
assert.equal(db.inMemoryOnly, true);
assert.equal(db.persistence.inMemoryOnly, true);
});

@@ -46,10 +45,10 @@

assert.isNull(err);
docs.length.should.equal(2);
doc2.a.should.equal(40);
doc3.a.should.equal(400);
assert.equal(docs.length, 2);
assert.equal(doc2.a, 40);
assert.equal(doc3.a, 400);
db.find({ a: { $lt: 36 } }, function (err, docs) {
assert.isNull(err);
docs.length.should.equal(1);
docs[0].a.should.equal(4);
assert.equal(docs.length, 1);
assert.equal(docs[0].a, 4);
done();

@@ -79,13 +78,13 @@ });

assert.isNull(err);
docs.length.should.equal(4);
_.find(docs, function (doc) { return doc._id === newDoc1._id; }).planet.should.equal('Earth');
_.find(docs, function (doc) { return doc._id === newDoc2._id; }).planet.should.equal('Mars');
_.find(docs, function (doc) { return doc._id === newDoc4._id; }).planet.should.equal('Eaaaaaarth');
_.find(docs, function (doc) { return doc._id === newDoc5._id; }).planet.should.equal('Maaaars');
assert.equal(docs.length, 4);
assert.equal(_.find(docs, function (doc) { return doc._id === newDoc1._id; }).planet, 'Earth');
assert.equal(_.find(docs, function (doc) { return doc._id === newDoc2._id; }).planet, 'Mars');
assert.equal(_.find(docs, function (doc) { return doc._id === newDoc4._id; }).planet, 'Eaaaaaarth');
assert.equal(_.find(docs, function (doc) { return doc._id === newDoc5._id; }).planet, 'Maaaars');
db.find({ planet: /aa+r/ }, function (err, docs) {
assert.isNull(err);
docs.length.should.equal(2);
_.find(docs, function (doc) { return doc._id === newDoc4._id; }).planet.should.equal('Eaaaaaarth');
_.find(docs, function (doc) { return doc._id === newDoc5._id; }).planet.should.equal('Maaaars');
assert.equal(docs.length, 2);
assert.equal(_.find(docs, function (doc) { return doc._id === newDoc4._id; }).planet, 'Eaaaaaarth');
assert.equal(_.find(docs, function (doc) { return doc._id === newDoc5._id; }).planet, 'Maaaars');

@@ -110,8 +109,8 @@ done();

assert.isNull(err);
nr.should.equal(1);
assert.equal(nr, 1);
db.find({}, function (err, docs) {
docs.length.should.equal(2);
findById(docs, newDoc1._id).planet.should.equal('Eaaaaarth');
findById(docs, newDoc2._id).planet.should.equal('Saturn');
assert.equal(docs.length, 2);
assert.equal(findById(docs, newDoc1._id).planet, 'Eaaaaarth');
assert.equal(findById(docs, newDoc2._id).planet, 'Saturn');

@@ -121,8 +120,8 @@ // Failing update

assert.isNull(err);
nr.should.equal(0);
assert.equal(nr, 0);
db.find({}, function (err, docs) {
docs.length.should.equal(2);
findById(docs, newDoc1._id).planet.should.equal('Eaaaaarth');
findById(docs, newDoc2._id).planet.should.equal('Saturn');
assert.equal(docs.length, 2);
assert.equal(findById(docs, newDoc1._id).planet, 'Eaaaaarth');
assert.equal(findById(docs, newDoc2._id).planet, 'Saturn');

@@ -132,8 +131,8 @@ // Document replacement

assert.isNull(err);
nr.should.equal(1);
assert.equal(nr, 1);
db.find({}, function (err, docs) {
docs.length.should.equal(2);
findById(docs, newDoc1._id).planet.should.equal('Uranus');
findById(docs, newDoc2._id).planet.should.equal('Saturn');
assert.equal(docs.length, 2);
assert.equal(findById(docs, newDoc1._id).planet, 'Uranus');
assert.equal(findById(docs, newDoc2._id).planet, 'Saturn');

@@ -143,10 +142,10 @@ // Multi update

assert.isNull(err);
nr.should.equal(2);
assert.equal(nr, 2);
db.find({}, function (err, docs) {
docs.length.should.equal(2);
findById(docs, newDoc1._id).planet.should.equal('Uranus');
findById(docs, newDoc1._id).count.should.equal(3);
findById(docs, newDoc2._id).planet.should.equal('Saturn');
findById(docs, newDoc2._id).count.should.equal(3);
assert.equal(docs.length, 2);
assert.equal(findById(docs, newDoc1._id).planet, 'Uranus');
assert.equal(findById(docs, newDoc1._id).count, 3);
assert.equal(findById(docs, newDoc2._id).planet, 'Saturn');
assert.equal(findById(docs, newDoc2._id).count, 3);

@@ -173,3 +172,3 @@ done();

assert.isNull(err);
nr.should.equal(1);
assert.equal(nr, 1);

@@ -181,3 +180,3 @@ db.findOne({}, function (err, doc) {

assert.isNull(err);
nr.should.equal(1);
assert.equal(nr, 1);

@@ -201,10 +200,10 @@ db.findOne({}, function (err, doc) {

// Return upserted document
upsert.a.should.equal(4);
upsert.b.should.equal(1);
nr.should.equal(1);
assert.equal(upsert.a, 4);
assert.equal(upsert.b, 1);
assert.equal(nr, 1);
db.find({}, function (err, docs) {
docs.length.should.equal(1);
docs[0].a.should.equal(4);
docs[0].b.should.equal(1);
assert.equal(docs.length, 1);
assert.equal(docs[0].a, 4);
assert.equal(docs[0].b, 1);

@@ -226,7 +225,7 @@ done();

assert.isNull(err);
nr.should.equal(2);
assert.equal(nr, 2);
db.find({}, function (err, docs) {
docs.length.should.equal(1);
docs[0].a.should.equal(2);
assert.equal(docs.length, 1);
assert.equal(docs[0].a, 2);

@@ -236,7 +235,7 @@ // Remove with no match

assert.isNull(err);
nr.should.equal(0);
assert.equal(nr, 0);
db.find({}, function (err, docs) {
docs.length.should.equal(1);
docs[0].a.should.equal(2);
assert.equal(docs.length, 1);
assert.equal(docs[0].a, 2);

@@ -246,6 +245,6 @@ // Simple remove

assert.isNull(err);
nr.should.equal(1);
assert.equal(nr, 1);
db.find({}, function (err, docs) {
docs.length.should.equal(0);
assert.equal(docs.length, 0);

@@ -273,3 +272,3 @@ done();

var candidates = db.getCandidates({ a: 6 })
candidates.length.should.equal(3);
assert.equal(candidates.length, 3);
assert.isDefined(_.find(candidates, function (doc) { return doc.a === 4; }));

@@ -282,3 +281,3 @@ assert.isDefined(_.find(candidates, function (doc) { return doc.a === 6; }));

candidates = db.getCandidates({ a: 6 })
candidates.length.should.equal(1);
assert.equal(candidates.length, 1);
assert.isDefined(_.find(candidates, function (doc) { return doc.a === 6; }));

@@ -304,3 +303,3 @@

db.insert({ u : 5 }, function (err) {
err.errorType.should.equal('uniqueViolated');
assert.equal(err.errorType, 'uniqueViolated');

@@ -307,0 +306,0 @@ done();

@@ -537,3 +537,3 @@ /**

comparisonFunctions.$ne = function (a, b) {
if (!a) { return true; }
if (a === undefined) { return true; }
return !areThingsEqual(a, b);

@@ -540,0 +540,0 @@ };

{
"name": "nedb",
"version": "0.11.0",
"version": "0.11.1",
"author": {

@@ -5,0 +5,0 @@ "name": "Louis Chatriot",

@@ -498,3 +498,3 @@ # NeDB (Node embedded database)

// This example works the same way with $addToSet
db.update({ _id: 'id6' }, { $push: { fruits: ['banana', 'orange'] } }, {}, function () {
db.update({ _id: 'id6' }, { $push: { fruits: {$each: ['banana', 'orange'] } } }, {}, function () {
// Now the fruits array is ['apple', 'orange', 'pear', 'banana', 'orange']

@@ -501,0 +501,0 @@ });

@@ -1043,2 +1043,3 @@ var model = require('../lib/model')

model.match({ a: 5 }, { b: { $ne: 5 } }).should.equal(true);
model.match({ a: false }, { a: { $ne: false } }).should.equal(false);
});

@@ -1045,0 +1046,0 @@

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