All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Explicitly import
buffer
#34, thanks maxdaniel98. - Fix
Cursor
's typings #45. - Removes unnecessary uses of the native
path
module for the browser and React-Native version by replacing the internalPersistance.ensureDirectoryExistsAsync
static method withPersistance.ensureParentDirectoryExistsAsync
so that anypath
functions are used only in Node.js where it is necessary, as it is not necessary for the browser and React-Native #51. - Explicit return/callback type for update based on options #44, thanks RobMayer.
- Fixed EPERM Exception when datastore is at the root of a disk on Windows #48
- Fixed typo in documentation #36
- Replace
$stat
from documentation with$exists
#32
- Add
_id
to the TS typings #30
- Updated devDependencies
- [BREAKING] Implement compound indexes #27. Commas (
,
) can no longer be used in indexed field names.
- [BREAKING] Updated @seald-io/binary-search-tree to
v1.0.3
, which changes syntax of some error messages, in particular the key constraint violation. - Updated dev dependencies, including
standard@17.0.0
which changed some linting rules. - Updated API docs.
- No longer execute
test-typings.ts
to check typings, just compile it. - Update
actions/checkout
andactions/setup-node
to v3.
- Added a
testSerializationHooks
option which defaults totrue
. Setting tofalse
allows to skip the test of the hooks, which may be slow.
- Added a
Promise
-based interface. - The JSDoc is now much more exhaustive.
- An auto-generated JSDoc file is generated: API.md.
- Added
Datastore#dropDatabaseAsync
and its callback equivalent. - The Error given when the
Datastore#corruptAlertThreshold
is reached now has three properties:dataLength
which is the amount of lines in the database file (excluding empty lines),corruptItems
which is the amount of corrupted lines,corruptionRate
which the rate of corruption between 0 and 1. - Added a
modes: { fileMode, dirMode }
option to the Datastore which allows to set the file and / or directory modes, by default, it uses0o644
for files and0o755
for directories, which may be breaking.
- The
corruptionAlertThreshold
now doesn't take into account empty lines, and the error message is slightly changed. - The
Datastore#update
's callback has its signature slightly changed. Theupsert
flag is always defined either attrue
orfalse
but notnull
norundefined
, andaffectedDocuments
isnull
when none is given rather thanundefined
(except when there is an error of course). - In order to expose a
Promise
-based interface and to removeasync
from the dependencies, many internals have been either rewritten or removed:- Datastore:
Datastore#getCandidates
replaced withDatastore#_getCandidatesAsync
;Datastore#resetIndexes
replaced withDatastore#_resetIndexes
;Datastore#addToIndexes
replaced withDatastore#_addToIndexes
;Datastore#removeFromIndexes
replaced withDatastore#_removeFromIndexes
;Datastore#updateIndexes
replaced withDatastore#_updateIndexes
;Datastore#_insert
replaced withDatastore#_insertAsync
;Datastore#_update
replaced withDatastore#_updateAsync
;Datastore#_remove
replaced withDatastore#_removeAsync
;
- Persistence:
Persistence#loadDatabase
replaced withPersistence#loadDatabaseAsync
;Persistence#persistCachedDatabase
replaced withPersistence#persistCachedDatabaseAsync
;Persistence#persistNewState
replaced withPersistence#persistNewStateAsync
;Persistence#treatRawStream
replaced withPersistence#treatRawStreamAsync
;Persistence.ensureDirectoryExists
replaced withPersistence.ensureDirectoryExistsAsync
;
- Cursor:
Cursor#_exec
replaced withCursor#_execAsync
;Cursor#project
replaced withCursor#_project
;Cursor#execFn
has been renamed toCursor#mapFn
and no longer supports a callback in its signature, it must be a synchronous function.
- Executor: it has been rewritten entirely without the
async
library.Executor#buffer
&Executor#queue
do not have the same signatures as before;Executor#push
replaced withExecutor#pushAsync
which is substantially different;
- Storage modules : callback-based functions have been replaced with promise-based functions.
- Model module: it has been slightly re-written for clarity, but no changes in its interface were made.
- Datastore:
- Typings were updated accordingly.
- Using a
string
in the constructor of NeDB is now deprecated. - Using
Datastore#persistence#compactDatafile
is now deprecated, please useDatastore#compactDatafile
instead. - Using
Datastore#persistence#setAutocompactionInterval
is now deprecated, please useDatastore#setAutocompactionInterval
instead. - Using
Datastore#persistence#stopAutocompaction
is now deprecated, please useDatastore#stopAutocompaction
instead.
- The option for passing
options.nodeWebkitAppName
to the Datastore and the Persistence constructors has been removed, subsequently, the static methodPersistence.getNWAppFilename
has been removed as well; - Compatibility with node < 10.1.0 (we use
fs.promises
).
- [cherry picked from 2.2.2] #21 Typings for loadDatabase now support a callback.
- #21 Typings for loadDatabase now support a callback.
- #20 storage.js: check fsync capability from return code rather than using process.platform heuristics (Thanks @bitmeal).
- Include a
"react-native"
version (heavily inspired from react-native-local-mongdb).
- The browser version uses
browser-version/lib/storage.browser.js
instead ofbrowser-version/lib/storage.js
in the"browser"
field of the package.json.
Thanks to @eliot-akira for the amazing work on file streaming.
- implement file streaming of the database like a PR on the original repo did;
- internalize
byline
package because it is unmaintained. - TypeScript typings inside the package.
- switch back to an AVLTree instead of a BinarySearchTree like the original nedb to fix #1.
- updated vulnerable dev dependency
ws
- no longer use
util
module for type verification as it is needed in the browser, which would need a polyfill.
- the
browser
field of thepackage.json
no longer points to the bundled minified version for the browser, but switches thestorage.js
andcustomUtils.js
to their browser version, just like the original repository used to do.
- bump
@seald-io/binary-search-tree
to 1.0.2, which does not depend onunderscore
; - replace use of
underscore
by pure JS.
This version should be a drop-in replacement for nedb@1.8.0
provided you use
modern browsers / versions of Node.js since ES6 features are now used (such
as class
and const
/ let
).
- Update
homepage
&repository
fields in thepackage.json
- New maintainer seald and new package name @seald-io/nedb;
- Added
lockfileVersion: 2
package-lock.json
; - Modernized some of the code with ES6 features (
class
,const
&let
); - Uses
standard
to lint the code (which removes all unnecessary semicolons); - Updated dependencies, except
async
which stays at0.2.10
for the moment; - Stop including the browser version in the repository, and properly build it
with
webpack
; - Uses
karma
to run the browser tests, and use npm to fetch versioned dependencies rather than having hardcoded copies of the dependencies in the repository; - Internalized
exec-time
dependency for the benchmarks, because it was unmaintained; - Uses
@seald-io/binary-search-tree
rather than unmaintainedbinary-search-tree
;
- Compatibility with old browsers and old version of Node.js that don't support ES6 features.
- From now on, this package won't be published with
bower
as it became essentially useless. - Entries in the
browser
field of package.json don't include individual files, only the bundled minified version, those files are still published with the package.
- This version no longer
uses a vulnerable version of
underscore
.
See original repo