I have an object below.
{
"_id" : "8LEfPt57rWHZ8ebdS",
"createdAt" : ISODate("2015-04-07T16:00:30.798Z"),
"services" : {
"password" : {
"bcrypt" : "$2a$10$SIUgFIWTq6nBmTIqNjMYFOSKtds.yR26fm8yblbcRm3yYeg.rH3jK"
},
"resume" : {
"loginTokens" : [
{
"when" : ISODate("2015-04-07T16:00:30.992Z"),
"hashedToken" : "Qnq4m/ETqI/heHPIYGdAJIyYQJNQ0EH5MFgDjgQt2GY="
},
{
"when" : ISODate("2015-04-09T14:49:08.652Z"),
"hashedToken" : "xxm3xXggjT1v8vcaY4/uLXUtPdMKyXaPp7xCLF6gBeM="
}
]
}
},
}
I want to get the list of users,who has logged in a date range .
But I am not getting any result for below query.
db.users.find({ 'services.resume.loginTokens': { $elemMatch: { when: { '$lte': '2015-04-11T18:29:59.999Z', '$gte': '2015-04-04T18:29:59.999Z' } } } })
Can anyone will help me on this.