Comparing version 1.1.2 to 1.1.3
@@ -27,2 +27,6 @@ /** | ||
function checkKey (k, v) { | ||
if (typeof k === 'number') { | ||
k = k.toString(); | ||
} | ||
if (k[0] === '$' && !(k === '$$date' && typeof v === 'number') && !(k === '$$deleted' && v === true) && !(k === '$$indexCreated') && !(k === '$$indexRemoved')) { | ||
@@ -68,6 +72,6 @@ throw 'Field names cannot begin with the $ character'; | ||
var res; | ||
res = JSON.stringify(obj, function (k, v) { | ||
checkKey(k, v); | ||
if (v === undefined) { return undefined; } | ||
@@ -332,3 +336,3 @@ if (v === null) { return null; } | ||
var arr, i; | ||
if (!util.isArray(obj[field])) { throw "Can't $pull an element from non-array values"; } | ||
@@ -425,3 +429,3 @@ | ||
checkObject(newDoc); | ||
if (obj._id !== newDoc._id) { throw "You can't change a document's _id"; } | ||
@@ -450,3 +454,3 @@ return newDoc; | ||
if (fieldParts.length === 1) { return obj[fieldParts[0]]; } | ||
if (util.isArray(obj[fieldParts[0]])) { | ||
@@ -679,3 +683,3 @@ // If the next field is an integer, return only this item of the array | ||
} | ||
// Normal query | ||
@@ -686,3 +690,3 @@ queryKeys = Object.keys(query); | ||
queryValue = query[queryKey]; | ||
if (queryKey[0] === '$') { | ||
@@ -712,3 +716,3 @@ if (!logicalOperators[queryKey]) { throw "Unknown logical operator " + queryKey; } | ||
if (queryValue !== null && typeof queryValue === 'object' && !util.isRegExp(queryValue)) { | ||
keys = Object.keys(queryValue); | ||
keys = Object.keys(queryValue); | ||
for (i = 0; i < keys.length; i += 1) { | ||
@@ -715,0 +719,0 @@ if (arrayComparisonFunctions[keys[i]]) { return matchQueryPart(obj, queryKey, queryValue, true); } |
{ | ||
"name": "nedb", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"author": { | ||
@@ -44,3 +44,3 @@ "name": "Louis Chatriot", | ||
}, | ||
"licence": "MIT" | ||
"license": "SEE LICENSE IN LICENSE" | ||
} |
@@ -6,4 +6,4 @@ # NeDB (Node embedded database) | ||
**Embedded persistent database for Node.js, written in Javascript, with no dependency** (except npm | ||
modules of course). You can **think of it as a SQLite for Node.js projects**, 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. | ||
modules), 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+). | ||
@@ -633,2 +633,3 @@ NeDB is not intended to be a replacement of large-scale databases such as MongoDB! Its goal is to provide you with a clean and easy way to query data and persist it to disk, for web applications that do not need lots of concurrent connections, for example a <a href="https://github.com/louischatriot/braindead-ci" target="_blank">continuous integration and deployment server</a> and desktop applications built with <a href="https://github.com/rogerwang/node-webkit" target="_blank">Node Webkit</a>. | ||
* If you've outgrown NeDB, switching to MongoDB won't be too hard as it is the same API. Use <a href="https://github.com/louischatriot/nedb-to-mongodb" target="_blank">this utility</a> to transfer the data from a NeDB database to a MongoDB collection | ||
* An ODM for NeDB: <a href="https://github.com/scottwrobinson/camo" target="_blank">Camo</a> | ||
@@ -635,0 +636,0 @@ |
@@ -165,2 +165,8 @@ var model = require('../lib/model') | ||
it('Can accept objects whose keys are numbers', function () { | ||
var o = { 42: true }; | ||
var s = model.serialize(o); | ||
}); | ||
}); // ==== End of 'Serialization, deserialization' ==== // | ||
@@ -167,0 +173,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
Misc. License Issues
License(Experimental) A package's licensing information has fine-grained problems.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
782351
18114
645
4
1