Closed soullivaneuh closed 2 years ago
@soullivaneuh I think you may have missed it, but this version of NeDB has supported a Promise-based interface for months. See https://github.com/seald/nedb/blob/master/CHANGELOG.md#300---2022-03-16
Oh my god, I indeed come from directly the old NeDB project with my old implementation.
Sorry for this stupid move, and thanks for the quick answer!
Is your feature request related to a problem? Please describe. For complex requests implementation, like for data migration, I need to fetch data from many databases and use them to update others.
Using the current callback system is quite limiting, forcing me to chain the data fetch callbacks until the update one.
Describe the solution you'd like
Instead of callback, make this library embracing promises.
Using promises also allow us to use the
async/await
keywords to have a more imperative code structure that can be easier to read and understand on some cases. For example:Describe alternatives you've considered I don't see any alternative.
Additional context
This was a subject already evoked on the original project (https://github.com/louischatriot/nedb/issues/673) but without any official answer.