You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running the migrate up command, it consoles that schema hasn't been registered for my models, whereas I imported the schema, and used mongoose.mode to create the model.
The text was updated successfully, but these errors were encountered:
You have to import the schema to migration file and then write directly in up function smth like this:
const model = this('model', Model.schema)
After that use this model and it seems to work well.
It happens because migrate-mongoose and the model use different instances of mongoose connection. And that means that the model isn't connected yet when the migrator is. That's why the migrator doesn't see the model if you don't write thing that I've mentioned above.
When running the migrate up command, it consoles that schema hasn't been registered for my models, whereas I imported the schema, and used mongoose.mode to create the model.
The text was updated successfully, but these errors were encountered: