Hi, I hope you don't mind be opening a PR for this issue.
The return value of find() was previously Nedb.Cursor<(T & Document)[]>, which meant that the return value of Cursor.exec() ended up with a double-wrapped array.
Changing the interface of Cursor to always refer to the single entity, but extending a Promise of the array, fixes the issue (tested locally).
An alternative would have been to change the interface to Cursor<T extends any[]> implements Promise<T>, and update the return type of exec(): Promise<T>, but I felt that this option was simpler.
Let me know if you have any questions or feedback!
Hi, I hope you don't mind be opening a PR for this issue. The return value of
find()
was previouslyNedb.Cursor<(T & Document)[]>
, which meant that the return value ofCursor.exec()
ended up with a double-wrapped array.Changing the interface of Cursor to always refer to the single entity, but extending a Promise of the array, fixes the issue (tested locally).
An alternative would have been to change the interface to
Cursor<T extends any[]> implements Promise<T>
, and update the return type ofexec(): Promise<T>
, but I felt that this option was simpler.Let me know if you have any questions or feedback!
Fixes #43