Automattic/mongoose

Important! If you opened a separate connection using mongoose.createConnection() but attempt to access the model through mongoose.model(‘ModelName’) it will not work as expected since it is not hooked up to an active db connection. In this case access your model through the connection you created:

Source: Automattic/mongoose

 

I got bit by this in Mongoose today.  Spent a few hours staring down a rabbit hole. So if your Mongoose finds and creates are silently failing, this is absolutely something worth checking.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.