Comparing version 0.7.8 to 0.7.9
@@ -49,3 +49,3 @@ /** | ||
return { n: n, d: d, program: program }; | ||
} | ||
}; | ||
@@ -52,0 +52,0 @@ |
@@ -31,3 +31,3 @@ var fs = require('fs') | ||
options = options || {}; | ||
filename = options.filename | ||
filename = options.filename; | ||
this.inMemoryOnly = options.inMemoryOnly || false; | ||
@@ -34,0 +34,0 @@ this.pipeline = options.pipeline || false; |
@@ -97,3 +97,3 @@ var BinarySearchTree = require('binary-search-tree').AVLTree | ||
Index.prototype.remove = function (doc) { | ||
var key, self = this | ||
var key, self = this; | ||
@@ -100,0 +100,0 @@ if (util.isArray(doc)) { doc.forEach(function (d) { self.remove(d); }); return; } |
@@ -112,7 +112,7 @@ /** | ||
obj === null || | ||
(obj && obj.constructor && obj.constructor.name === 'Date') ) { | ||
(util.isDate(obj)) ) { | ||
return obj; | ||
} | ||
if (obj instanceof Array) { | ||
if (util.isArray(obj)) { | ||
res = []; | ||
@@ -576,4 +576,4 @@ obj.forEach(function (o) { res.push(o); }); | ||
keys = Object.keys(queryValue); | ||
firstChars = _.map(keys, function (item) { return item[0]; }) | ||
dollarFirstChars = _.filter(firstChars, function (c) { return c === '$'; }) | ||
firstChars = _.map(keys, function (item) { return item[0]; }); | ||
dollarFirstChars = _.filter(firstChars, function (c) { return c === '$'; }); | ||
@@ -580,0 +580,0 @@ if (dollarFirstChars.length !== 0 && dollarFirstChars.length !== firstChars.length) { |
{ | ||
"name": "nedb", | ||
"version": "0.7.8", | ||
"version": "0.7.9", | ||
"author": { | ||
@@ -5,0 +5,0 @@ "name": "tldr.io", |
@@ -36,2 +36,3 @@ # NeDB (Node embedded database) | ||
* `filename` (optional): path to the file where the data is persisted. If left blank, the datastore is automatically considered in-memory only. | ||
* `nodeWebkitAppName` (optional): if you are using NeDB from whithin a Node Webkit app, specify its name (the same one you use in the `package.json`) in this field and the `filename` will be relative to the directory Node Webkit uses to store the rest of the application's data (local storage etc.). It works on Linux, OS X and Windows. | ||
* `inMemoryOnly` (optional, defaults to false): as the name implies. | ||
@@ -47,3 +48,9 @@ * `pipeline` (optional, defaults to false): use pipelining. This is an experimental feature that speeds up writes (about 2x) but can sometime increase read times. You probably shouldn't use it yet. | ||
, db = new Datastore({ filename: 'path/to/datafile' }); | ||
// Persistent datastore for a Node Webkit app called 'nwtest' | ||
// For example on Linux, the datafile will be ~/.config/nwtest/nedb-data/something.db | ||
var Datastore = require('nedb') | ||
, db = new Datastore({ filename: 'something.db', nodeWebkitAppName: 'nwtest' }); | ||
db.loadDatabase(function (err) { // Callback is optional | ||
@@ -50,0 +57,0 @@ // err is the error, if any |
@@ -6,2 +6,3 @@ var model = require('../lib/model') | ||
, async = require('async') | ||
, util = require('util') | ||
; | ||
@@ -83,3 +84,3 @@ | ||
b.indexOf('\n').should.equal(-1); | ||
c.test.constructor.name.should.equal('Date'); | ||
util.isDate(c.test).should.equal(true); | ||
c.test.getTime().should.equal(d.getTime()); | ||
@@ -86,0 +87,0 @@ }); |
219971
4691
407