In MongoDB I have a collection of documents called 'clients', where each document is structured roughly as follows. Note that TimeStamp is a DateTime:
{
"Sessions": [
{
"SessionId": "pojiu5iprr2xw5ucsudyrkpv",
"LocationId": {
"$oid": "4de4590bfcee1a1b44165e2b"
},
"Timestamp": "Wed, 01 Jun 2011 09:39:26 GMT -04:00"
}
],
"_id": {
"$oid": "4de6410efcee1a1204a3326c"
}
}
I'd like to be able to query for "all clients which have at least one session with a timestamp in the last 24 hours". Is this possible without resorting to a full M/R scan? I will also accept answers with a statically defined Date, e.g. "all clients which have at least one session with a timestamp later than 1/5/2012"