Mongoose Find not working Mongoose Find not working mongoose mongoose

Mongoose Find not working


Change your Skill.js for this

var mongoose = require('mongoose');mongoose.set('debug', true);//Skill schema definitionvar skillSchema = new mongoose.Schema({  name: String,  length: String,});var Skill = mongoose.model('Skill', skillSchema);module.exports = Skill;

After that, you can see at the console if mongoose is doing your queries.


I was in the same situation as you describe and it turns out I didn't understand the magic of mongoose collection naming, in your code it will try to load the "skills" and if that's not what it's named in your mongo nothing will be returned. Should really toss a "so such collection" error instead imho.


This below method gives an alternate name for your collection

var skillSchema = new mongoose.Schema({  name: String,  length: String,},{collection : 'Skill'});or var Skill = mongoose.model('Skill', skillSchema,''Skill);