I have my data like this in my database
[{
"birth-date": "18/12/2010",
"babies": [{
"name": "James",
"age": 8,
}, {
"name": "John",
"age": 4,
}]
}]
So I do my schema like below
var babiesSchema = new Schema({
birth-date: Date, // tried String too
babies: [{
name: String,
age: Number
}]
});
var Babies = mongoose.model('babies', babiesSchema);
I do
Babies.find({}, function(response){
res.json(response)
})
I got null, is something wrong with my schema? There is no error in my node's terminal.