Let’s suppose I need to search all records that match a date condition. On MongoDB I’ve a bunch of data like this:
{
"_id" : "9ed3b937-0f43-4613-bd58-cb739a8c5bf6",
"userModels" : {
"5080" : {
"generated_date_timestamp" : NumberLong(1413382499442),
"model_id" : 5080,
},
}
"values" : {}
} |
This is the query:
db.anonProfile.find({
"userModels.5080.generated_date_timestamp" : {
"$gte" : ISODate("2013-10-01T00:00:00.000Z").getTime()
}
}); |
.getTime() |
allows to translate ISODate into a NumberLong timestamp.