-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Description
mongoose 4.11.0
When using openUri
the connection onOpen
is not getting called and as a result all collections are in "buffer" mode, maybe the following line should be replaced to _this.onOpen()
https://github.com/Automattic/mongoose/blob/master/lib/connection.js#L739
[Edit] I'll elaborate as I forgot to mention I did a little hack :)
What I was trying to achieve is make createConnection
to always return the Connection object, whether it was called with useMongoClient
or not. The fact that it returns a Promise is breaking my code as now I need to wait for the Promise to resolve before I can define models on this connection.
So maybe the correct question is "Why createConnection doesn't return the connection but a Promise?", since connection has a buffer mechanism, and it is an emitter that emits an "open" event it make sense to get it immediately (like it was before 4.11.0).
Thoughts?