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.8.11 to 0.8.12

benchmarks/findWithIn.js

41

benchmarks/commonUtilities.js

@@ -127,3 +127,3 @@ /**

if (i === n) { // Finished
console.log("===== RESULT (find) ===== " + Math.floor(1000* n / profiler.elapsedSinceLastStep()) + " ops/s");
console.log("===== RESULT (find with in selector) ===== " + Math.floor(1000* n / profiler.elapsedSinceLastStep()) + " ops/s");
profiler.step('Finished finding ' + n + ' docs');

@@ -145,2 +145,41 @@ return cb();

/**
* Find documents with find and the $in operator
*/
module.exports.findDocsWithIn = function (d, n, profiler, cb) {
var beg = new Date()
, order = getRandomArray(n)
, ins = [], i, j
, arraySize = Math.min(10, n) // The array for $in needs to be smaller than n (inclusive)
;
// Preparing all the $in arrays, will take some time
for (i = 0; i < n; i += 1) {
ins[i] = [];
for (j = 0; j < arraySize; j += 1) {
ins[i].push((i + j) % n);
}
}
profiler.step("Finding " + n + " documents WITH $IN OPERATOR");
function runFrom(i) {
if (i === n) { // Finished
console.log("===== RESULT (find with in selector) ===== " + Math.floor(1000* n / profiler.elapsedSinceLastStep()) + " ops/s");
profiler.step('Finished finding ' + n + ' docs');
return cb();
}
d.find({ docNumber: { $in: ins[i] } }, function (err, docs) {
if (docs.length !== arraySize) { return cb('One find didnt work'); }
executeAsap(function () {
runFrom(i + 1);
});
});
}
runFrom(0);
};
/**
* Find documents with findOne

@@ -147,0 +186,0 @@ */

9

lib/datastore.js

@@ -398,3 +398,3 @@ var customUtils = require('./customUtils')

, candidates = this.getCandidates(query)
, i
, i, found = null
;

@@ -405,3 +405,3 @@

if (model.match(candidates[i], query)) {
return callback(null, model.deepCopy(candidates[i]));
found = model.deepCopy(candidates[i]);
}

@@ -413,3 +413,3 @@ }

return callback(null, null);
return callback(null, found);
};

@@ -478,3 +478,3 @@

modifiedDoc = model.modify(candidates[i], updateQuery);
modifications.push({ oldDoc: candidates[i], newDoc: modifiedDoc });
modifications.push({ oldDoc: candidates[i], newDoc: modifiedDoc });
}

@@ -549,3 +549,2 @@ }

module.exports = Datastore;
{
"name": "nedb",
"version": "0.8.11",
"version": "0.8.12",
"author": {

@@ -5,0 +5,0 @@ "name": "tldr.io",

Sorry, the diff of this file is too big to display

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