-
Notifications
You must be signed in to change notification settings - Fork 1k
Change log
Louis Chatriot edited this page Feb 15, 2016
·
59 revisions
The change log only begins at v0.7.14. I didn't feel the need to make one before but now there are more and more users wondering why they can't use functionality X when it's only a version problem.
- If
false/undefined/null
is passed as callback to CRUD functions, the executor doesn't get stuck anymore. - Timestamped databases now keep
createdAt
after an update that's a complete document replacement. - Fixed edge behavior where in updates
false/undefined/null
fields were treated as non-existent fields and replaced by a nested object when dot-notation was followed. For example for the document{ nested: false }
and the update query{ $set: { 'nested.really': 42 } }
, NeDB was wronlgy returning{ nested: { really: 42 } }
and now returns{ nested: false }
. - Fixed edge behavior where in updated nested objects were created on the fly while following dot notation for
$unset
modifier. For example for the document{ hello: 'world' }
and the query{ $unset: { 'nested.really': true } }
, NeDB was wrongly returning{ hello: 'world', nested: {} }
and now returns{ hello: 'world' }
. - Projection work with embedded documents and dot notation.
-
BREAKING update callback signature is now coherent in all cases.
- v1.8 and onwards signature:
(err, numAffected, affectedDocuments, upsert)
- For an upsert,
affectedDocuments
contains the inserted document and theupsert
flag is set totrue
. - For a standard update with
returnUpdatedDocs
flag set tofalse
,affectedDocuments
is not set. - For a standard update with
returnUpdatedDocs
flag set totrue
andmulti
tofalse
,affectedDocuments
is the updated document. - For a standard update with
returnUpdatedDocs
flag set totrue
andmulti
totrue
,affectedDocuments
is the array of updated documents.
- For an upsert,
- v1.7.4 and prior signature:
(err, numAffected, affectedDocuments)
- For an upsert,
affectedDocuments
is the inserted document and noupsert
flag is set. - For a standard update with
returnUpdatedDocs
set totrue
the array of updated documents is returned, even ifmulti
isfalse
.
- For an upsert,
- v1.8 and onwards signature:
- Support for
$min
and$max
update operators
- Support for
$elemMatch
find operator
- Support for
$slice
operator in cunjunction with$push
and$each
- Support for TTL indexes able to expire and remove documents after a given period of time
- Can perform a direct array match on array fields.
- Datastores fires an
compaction.done
event whenever a compaction operation finishes.
- Support for custom string comparison functions, for international datastores (JavaScript's built-in function does not play nice with accented letters in particular).
- Lots of housekeeping!
- Throw and use Error objects as errors instead of plain Javascript strings or objects, to provide more information to consumers (in particular
err.stack
).
- Flush data to disk whenever datafile is compacted to ensure no data loss possible in case of a server crash.
- Don't use crash safe file write on the browser to increase storage limit twofold
- Use
localforage
to store data, selects the best method available (IndexedDB, WebSQL or localStorage). In most cases that means a lot of data can be stored, typically in hundreds of MB. WARNING: the storage system changed between v1.3 and v1.4 and is NOT back-compatible! Your application needs to resync client-side when you upgrade NeDB.
- Added document timestamping
- Fixed rare bug causing side effects on user data
- Fix issue with $in queries that would return multiple times the same documents if the $in field is indexed
- Updated nedb to fully adhere to latest Node.js version (v4) which uses ES6
- Updated package mkdirp to enable use of nedb in strict mode
- Fixed bugs in Safari caused by number field names
- NeDB won't start if one hook is declared but not the other, or if they're not reverse of one another to prevent dataloss
- NeDB won't start if too much data is detected as corrupt, threshold can be defined by user
- Created serialization hooks, see https://github.com/louischatriot/nedb#creatingloading-a-database
- Fixed minor bug where an upsert with a badly formatted update query would throw an error, not a standard error in the callback
- Fixed minor deep copying bug where arrays would not get deep copied
- Fixed upsert behavior with find queries with operators to match MongoDB
After 18 months, finally releasing NeDB version 1! No real bug reported on either the Nodejs or browser versions for the past 2 months, NeDB works in all environments including Tessel, is used by some major projects (looking at you Popcorn Time) and the feature set is what you would expect from a full pure JS database.
- Fixed small bug where you couldn't set a document's _id to 0
- Fixed bug on
$ne
operator, with undefined, null or false - Replaced all use of
chai.should
bychai.assert
in the browser tests aschai.should
doesn't work on Internet Explorer 9
- Implemented persistence for the browser version. Should work on all browsers NeDB works on (IE9+, Chrome, Firefox, Opera)
- Use
setImmediate
instead ofprocess.nextTick
to prevent event loop I/O starvation (thanks, @TomV)
- _id is guaranteed to be unique across one database. Before, there was an extremely low probability of collision (about one in a million for a datastore with 1e12 documents)
- Updated
binary-search-tree
to latest version - Added support for projections
- Minor code tidying
- Fixed strange Date behaviour in Node Webkit due to differences in the Date implementation between Node Webkit and Node (thanks, @szwacz)
- Added support for setting own _id (thanks, @pscanf)
- Fixed bug on multiple sort (thanks, @timshadel)
- Use async v0.2.10 so that NeDB works right away with browserify
- Fixed executor bug preventing running operations after an exception was thrown from within a callback. Note that you shouldn't throw exceptions in an asynchronous code anyway
- Added comparison operator
$where
- When performing an upsert, the upserted document is returned instead of
true
- Added Cursor API and ability to sort, skip, limit
- Added the ability to specify a handler called after autoloading the database, and a default handler that throws an exception if there is an error during load instead of failing silently
- Fixed bug in persistence with Node Webkit apps that could cause an
EXDEV
error in some cases - Deprecated the
nodeWebkitAppName
option
- Added
removeIndex
method - Added persistence for indexes
- Added support for
$size
operator - Added support for querying inside arrays with dot notation
- Added support for querying specific array items with
field.i
notation (i integer)
- Fixed bug that could cause data loss when a process crash occured during a loadDatabase (it had never occured but that was a possible scenario)
- Added ability to bulk-insert an array of documents
- Fixed bug in indexing array fields
- Added the
$pull
array modifier (thanks, @szwacz)
- Fixed various minor bugs
- Made options argument to update and remove optional
- Added
Datastore.count
- Added the
$unset
modifier - Minor fixes
- Ported NeDB to the browser (still needs to be tested on all major browsers but it works fine on Chrome). In-memory only for now
- Added support for regular expression matching in basic querying
- Added $regex operator to be able to use regular expressions along with other operators
- CRUD functionality. Includes insert, find, findOne, update (with multi or single updates and upserts), remove (with multi or single removes)
- Following operators for querying: $lt, $lte, $gt, $gte, $in, $nin, $ne, $exists, $or, $and, $not
- As with Mongo, you can if a document's field is an array, matching the document means matching any element of the array
- Modifiers to update documents: $set, $inc, and array modifiers ($push, $pop, $addToSet, $each)
- Indexing (works with exact matching, comparison operators and $in)
- Support for persistent (using an append-only data file) or in-memory only datastores
- Support for database autoloading upon creation