moleculerjs/moleculer-db

[Mongoose V7] : Connection.prototype.close() no longer accepts a callback

thib3113 opened this issue · 2 comments

From mongoose V7, async functions will throw an error if we pass a callback (and so will skip his job) .

I saw this async functions was added years ago (4.3.8-pre) : Automattic/mongoose@21f0104
so, I think we can migrate to full promise (removing callback) without problems .

Also, we already use promises, but, passing the "resolve" function to the callback .


Actually, stopping a moleculer service, will not close the connection ( close will throw before really closing the connection )

@icebob what versions of mongoose do you want to support on this lib ? I didn't find the information .

If not decided, I propose to follow the same as mongoose itself ? https://mongoosejs.com/docs/version-support.html so, supporting V6 and V7 . ( maybe V5 and we stop the support in some months ? )

icebob commented

The current version supports v6, we can support v7, but in this case we should release it in a new major version.