I'm using mongoose to store information. My problem is that I need to find a previously registered model by it's name.
I register my model using the following source:
global.dbConn1.model('UserModel', new mongoose.Schema({
name: String
}, {versionKey: false}))
Later, I'm trying to access my model by it's name and query it:
mongoose.model('UserModel').findById('<ID>', console.log /* CALLBACK */)
The problem is that findById() never returns. I'm getting no output, hence the callback (console.log) is never called. But I'm getting no error and the userModel is also correct.
Any idea why the CALLBACK is never called?