Comparing version 1.2.0 to 1.2.1
@@ -249,3 +249,3 @@ var BinarySearchTree = require('binary-search-tree').AVLTree | ||
Index.prototype.getMatching = function (value) { | ||
var res, self = this; | ||
var self = this; | ||
@@ -255,4 +255,14 @@ if (!util.isArray(value)) { | ||
} else { | ||
res = []; | ||
value.forEach(function (v) { append(res, self.getMatching(v)); }); | ||
var _res = {}, res = []; | ||
value.forEach(function (v) { | ||
self.getMatching(v).forEach(function (doc) { | ||
_res[doc._id] = doc; | ||
}); | ||
}); | ||
Object.keys(_res).forEach(function (_id) { | ||
res.push(_res[_id]); | ||
}); | ||
return res; | ||
@@ -259,0 +269,0 @@ } |
{ | ||
"name": "nedb", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"author": { | ||
@@ -5,0 +5,0 @@ "name": "Louis Chatriot", |
@@ -1,9 +0,8 @@ | ||
# NeDB (Node embedded database) | ||
# NeDB - The Javascript Database | ||
<img src="http://i.imgur.com/GdeQBmc.png" style="width: 25%; height: 25%; float: left;"> | ||
**IMPORTANT NOTE: Please don't submit issues for questions regarding your code. Only actual bugs or feature requests will be answered, all others will be closed without comment.** | ||
**IMPORTANT NOTE: Please don't submit issues for questions regarding your code. Only actual bugs or feature requests will be answered, all others will be closed without comment. Also, please follow the <a href="#bug-reporting-guidelines">bug reporting guidelines</a>.** | ||
**Embedded persistent database for Node.js, written in Javascript, with no dependency** (except npm | ||
modules), which | ||
**Embedded persistent database for Node.js, Node Webkit and browsers, written in Javascript, with no binary dependency**, which | ||
can be used with a simple `require` statement. The API is a subset of MongoDB's. You can use it as a persistent or an in-memory only datastore, and it can also be used in all recent browsers (Chrome, Firefox, Safari, IE9+). | ||
@@ -637,4 +636,8 @@ | ||
## Help out | ||
Issues reporting and pull requests are always appreciated. For issues, make sure to always include a code snippet and describe the expected vs actual behavior. If you send a pull request, make sure to stick to NeDB's coding style and always test all the code you submit. You can look at the current tests to see how to do it | ||
## Bug reporting guidelines | ||
If you report a bug, thank you! That said for the process to be manageable please strictly adhere to the following guidelines. I'll not be able to handle bug reports that don't: | ||
* Your bug report should be a self-containing gist complete with a package.json for any dependencies you need. I need to run through a simple `git clone gist; npm install; node bugreport.js`, nothing more. | ||
* It should use assertions to showcase the expected vs actual behavior and be hysteresis-proof. It's quite simple in fact, see this example: https://gist.github.com/louischatriot/220cf6bd29c7de06a486 | ||
* Simplify as much as you can. Strip all your application-specific code. Most of the time you will see that there is no bug but an error in your code :) | ||
* 50 lines max. If you need more, read the above point and rework your bug report. If you're **really** convinced you need more, please explain precisely in the issue. | ||
@@ -641,0 +644,0 @@ ### Bitcoins |
@@ -631,8 +631,12 @@ var Index = require('../lib/indexes') | ||
it('Can get all documents whose key is in an array of keys', function () { | ||
// For this test only we have to use objects with _ids as the array version of getMatching | ||
// relies on the _id property being set, otherwise we have to use a quadratic algorithm | ||
// or a fingerprinting algorithm, both solutions too complicated and slow given that live nedb | ||
// indexes documents with _id always set | ||
var idx = new Index({ fieldName: 'tf' }) | ||
, doc1 = { a: 5, tf: 'hello' } | ||
, doc2 = { a: 2, tf: 'bloup' } | ||
, doc3 = { a: 8, tf: 'world' } | ||
, doc4 = { a: 7, tf: 'yes' } | ||
, doc5 = { a: 7, tf: 'yes' } | ||
, doc1 = { a: 5, tf: 'hello', _id: '1' } | ||
, doc2 = { a: 2, tf: 'bloup', _id: '2' } | ||
, doc3 = { a: 8, tf: 'world', _id: '3' } | ||
, doc4 = { a: 7, tf: 'yes', _id: '4' } | ||
, doc5 = { a: 7, tf: 'yes', _id: '5' } | ||
; | ||
@@ -639,0 +643,0 @@ |
Sorry, the diff of this file is too big to display
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
784517
18135
650