I have a people collection with a timeline array containing a year when something happened to this person. For example the year they were born, like this:
db.people.insert({
"timeline": [
{ "born_year": 1999 },
{ "other_event": 2005 }
]
});
I can query this collection for someone born 1999:
db.people.find({
"timeline": { $in: [ { "born_year": 1999 } ] }
});
However, when using $lt to query for people born before 2000 I don't get any results at all:
db.people.find({
"timeline": { $in: [ { "born_year": { $lt: 2000 } } ] }
});
Can anyone explain to me what I'm doing wrong here?