I have a collection that looks like this:
{
_id: ObjectId("50a68673476427844b000001"),
other fields
}
I want to do a range query to find records between two dates. I know that I can get the date from the ObjectId in the mongo shell var doing this:
var aDate = ObjectId().getTimestamp()
but there isn't a way (as far as I can figure out at the moment) to create an ObjectId consisting of just the timestamp portion - I think my ideal solution is non-functioning mongo shell code would be:
var minDate = ObjectId(new Date("2012-11-10"));
var maxDate = ObjectId(new Date("2012-11-17"));
Use the find with the minDate and MaxDate as the range values.
Is there a way to do this in the SHELL - I'm not interested in some of the driver products.