seald / nedb

The JavaScript Database, for Node.js, nw.js, electron and the browser
MIT License
351 stars 32 forks source link

findAsync Cursor return should include _id #45

Closed RobMayer closed 9 months ago

RobMayer commented 1 year ago

Describe the bug

db.findAsyc and db.findOneAsync Cursor return type does not include _id

Expected behavior If you're fetching a record or a list of records, that list of records should probably include the _id in its types return types of insert or update include them.

tex0l commented 9 months ago

I changed the type of Cursor so that it extends Promise<Document<T>> like its method execAsync instead of Promise<T>, as Cursor is a sort of "thenable" as it reimplements manually then, catch and finally simply by making a call to execAsync followed by then, catch or finally.

tex0l commented 9 months ago

It landed in 4.0.4