Open dremchee opened 4 months ago
@dremchee I believe Nedb.Cursor<T>
extends Promise<Document<T>>
, so it should already be the case once awaited, or am I wrong ?
@dremchee I believe
Nedb.Cursor<T>
extendsPromise<Document<T>>
, so it should already be the case once awaited, or am I wrong ?
I mean the findAsync
method, which should return an array
For example sandbox https://codesandbox.io/p/sandbox/nedb-generic-type-pr8lvv?file=%2Fsrc%2Findex.ts%3A13%2C1
I just encountered this. @dremchee is right.
// CURRENT BEHAVIOUR
const cursor = db.findAsync({ id: { $in: someArray}}(; // Cursor<T[]>
const result = await cursor.execAsync;() // Document<T[]>
result[0]._id // Should be a valid property but isn't showing up
result._id // Shouldn't be a valid property but is showing up
// EXPECTED BEHAVIOUR
const cursor = db.findAsync({ id: { $in: someArray}}(; // Cursor<T[]>
const result = await cursor.execAsync;() // Document<T>[]
result[0]._id // each row has an _id, does it now?
https://github.com/seald/nedb/blob/68279ccdf09fd3064ce5e02e0f3c30d75d8e2cfa/index.d.ts#L91
I think it should be like this
Document<T>[]
instead ofT[]