I am trying to implement a find in Mongoose. Everything works until there is too many records in the database. In my case, there are 8 records in the NewSchema collection. Do anyone know why this is happening?
My Sample Code:
var NewSchema = new Schema({
asd : String,
sdf : String,
dfg : String,
fgh : String,
bnmxcv : [String],
klj : String,
sdfsdf : String,
wer : String,
uio : Date
});
var New = mongoose.model('NewSchema', NewSchema);
New.find({asd:_id},
function(err, list) {
/////// IT FREEZES HERE ////////
});
You should also register the schema to Mongoose before trying to use it, try the following code:
var NewSchema = new Schema({
asd : String,
sdf : String,
dfg : String,
fgh : String,
bnmxcv : [String],
klj : String,
sdfsdf : String,
wer : String,
uio : Date
});
var NewSch = mongoose.model('NewSchema', NewSchema);
NewSch.find({asd:_id}, function(err, list) {
// do stuff
});