Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "startDate": ISODate("2015-01-01T00:00:00Z"),
- "endDate" : ISODate("2015-01-10T00:00:00Z"),
- "foo" : "bar"
- }
- {
- "dates": [
- ISODate("2015-01-01T00:00:00Z"),
- ISODate("2015-01-02T00:00:00Z"),
- ISODate("2015-01-03T00:00:00Z"),
- ISODate("2015-01-04T00:00:00Z"),
- ISODate("2015-01-05T00:00:00Z"),
- ISODate("2015-01-06T00:00:00Z"),
- ISODate("2015-01-07T00:00:00Z"),
- ISODate("2015-01-08T00:00:00Z"),
- ISODate("2015-01-09T00:00:00Z"),
- ISODate("2015-01-10T00:00:00Z")
- ]
- }
- {
- "_id" : ObjectId("55474c322e8f6b5a9dda1a0f"),
- "dates" : [
- ISODate("2015-01-01T00:00:00.000Z"),
- ISODate("2015-01-02T00:00:00.000Z"),
- ISODate("2015-01-03T00:00:00.000Z"),
- ISODate("2015-01-04T00:00:00.000Z"),
- ISODate("2015-01-05T00:00:00.000Z"),
- ISODate("2015-01-06T00:00:00.000Z"),
- ISODate("2015-01-07T00:00:00.000Z"),
- ISODate("2015-01-08T00:00:00.000Z"),
- ISODate("2015-01-09T00:00:00.000Z"),
- ISODate("2015-01-10T00:00:00.000Z")
- ]
- }
- //Example using subdocs
- {
- "_id" : ObjectId("55474e332e8f6b5a9dda1a10"),
- "dates" : [
- {
- "date" : ISODate("2015-01-01T00:00:00.000Z")
- },
- {
- "date" : ISODate("2015-01-02T00:00:00.000Z")
- },
- ... etc
- //using embedded docs
- db.rangeTest.find(
- {'dates.date': {$gte:ISODate("2015-01-08T00:00:00.000Z"), $lte:ISODate("2015-01-09T00:00:00.000Z")}},
- {_id:0, 'dates.$':1} )
Add Comment
Please, Sign In to add comment