artifacthealth / hydrate-mongodb

An Object/Document Mapping (ODM) framework for Node.js and MongodDB
Other
35 stars 10 forks source link

Return promises when callback isn't given #30

Open j opened 6 years ago

j commented 6 years ago

Now that promises are heavily supported (esp. by anyone using decorators), can they be returned by default?

This should also happen in the Session. I'd like to await a flush/save/any persistence.

meirgottlieb commented 6 years ago

We could not return promises by default for queries because queries chain methods together to build the query. We could do this for methods in the Session that do not support chaining (e.g. not for find). However, it would be a breaking change.