I'm trying to get document that it's 'from' field value in 'from' of 'periods' array.
I've tried followings but it doesn't work. how can i?
periods = [{
from: 333,
to: 555
},
{
from: 666,
to: 777
}]
var eqbookschema = new Schema({
eq_dbId: String,
user_dbId: String,
from: Number,
to: Number,
timestamp: Number,
}, {collection: 'book'});
EQBook = mongoose.model('EQBook', eqbookschema)
EQBook.find({
eq_dbId: req.body.eq_dbId,
from: {$in: [periods.from]}
})
The query I have tried only returns empty array although existing.