Nedb for modern javascript
Nedb with promises and typescript definitions
for plain Nedb typings see ramiroaisen/nedb-types
install
npm i nedb-promises-ts
Usage
; ; // or load afterawait collection.loadDatabase; // find .sort .skip5 .limit10 .projection) // OR;cursor.skip5; cursor.then... // same as cursor.exec.then... // findOne; // update; // remove // indexawait collection.ensureIndexfieldName: keyof Document<T>, options: IndexOptions; // and so on...
Everything is this repo works as expected and has a typescript definition
The functions have the same name as in the original nedb
Note: update queries resolves to an object with this props
numAffected: numberupsert: booleandocument: Document<T> // if options.returnUpdatedDocs set to true and options.multi set to falsy valuedocuments: Document<T> // if options.returnUpdatedDocs set to true and options.multi set to truthly value
More Notes
Cursor
objects has a .cursor
prop that points to the original nedb cursor
Datastore
objects has a .nedb
prop that points to the original nedb datastore
So if you must you can do collection.nedb.someOp((err, result) => ()}
If you have a comment open an issue in this repo :)