Model.find() returns empty in mongoose [duplicate]

Your problem is mongoose pluralizes collections. Mongoose is querying “organizations” but your data is in mongodb as “organization”. Make them match and you should be good to go. You can either rename it in mongodb via the mongo shell or tell mongoose about it. From the mongoose docs:

var schema = new Schema({ name: String }, { collection: 'actor' });

// or

schema.set('collection', 'actor');

// or

var collectionName="actor"
var M = mongoose.model('Actor', schema, collectionName)

Leave a Comment