@seald-io/nedb
Advanced tools
Changelog
[3.0.0] - 2022-03-16
Promise
-based interface.Datastore#dropDatabaseAsync
and its callback equivalent.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.modes: { fileMode, dirMode }
option to the Datastore which allows to set the file and / or directory modes, by default, it uses 0o644
for files and 0o755
for directories, which may be breaking.corruptionAlertThreshold
now doesn't take into account empty lines, and the error message is slightly changed.Datastore#update
's callback has its signature slightly changed. The
upsert
flag is always defined either at true
or false
but not null
nor
undefined
, and affectedDocuments
is null
when none is given rather than
undefined
(except when there is an error of course).Promise
-based interface and to remove async
from the dependencies, many internals have been either rewritten or removed:
Datastore#getCandidates
replaced with Datastore#_getCandidatesAsync
;Datastore#resetIndexes
replaced with Datastore#_resetIndexes
;Datastore#addToIndexes
replaced with Datastore#_addToIndexes
;Datastore#removeFromIndexes
replaced with Datastore#_removeFromIndexes
;Datastore#updateIndexes
replaced with Datastore#_updateIndexes
;Datastore#_insert
replaced with Datastore#_insertAsync
;Datastore#_update
replaced with Datastore#_updateAsync
;Datastore#_remove
replaced with Datastore#_removeAsync
;Persistence#loadDatabase
replaced with Persistence#loadDatabaseAsync
;Persistence#persistCachedDatabase
replaced with Persistence#persistCachedDatabaseAsync
;Persistence#persistNewState
replaced with Persistence#persistNewStateAsync
;Persistence#treatRawStream
replaced with Persistence#treatRawStreamAsync
;Persistence.ensureDirectoryExists
replaced with Persistence.ensureDirectoryExistsAsync
;Cursor#_exec
replaced with Cursor#_execAsync
;Cursor#project
replaced with Cursor#_project
;Cursor#execFn
has been renamed to Cursor#mapFn
and no longer supports a callback in its signature, it must be a synchronous function.async
library.
Executor#buffer
& Executor#queue
do not have the same signatures as before;Executor#push
replaced with Executor#pushAsync
which is substantially different;string
in the constructor of NeDB is now deprecated.Datastore#persistence#compactDatafile
is now deprecated, please use Datastore#compactDatafile
instead.Datastore#persistence#setAutocompactionInterval
is now deprecated, please use Datastore#setAutocompactionInterval
instead.Datastore#persistence#stopAutocompaction
is now deprecated, please use Datastore#stopAutocompaction
instead.options.nodeWebkitAppName
to the Datastore and the Persistence constructors has been removed, subsequently, the static method Persistence.getNWAppFilename
has been removed as well;fs.promises
).