daily pastebin goal
51%
SHARE
TWEET

Untitled

a guest Feb 11th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. {
  2.   "startDate": ISODate("2015-01-01T00:00:00Z"),
  3.   "endDate" : ISODate("2015-01-10T00:00:00Z"),
  4.   "foo" : "bar"
  5. }
  6.    
  7. {
  8.  "dates": [
  9.            ISODate("2015-01-01T00:00:00Z"),
  10.            ISODate("2015-01-02T00:00:00Z"),
  11.            ISODate("2015-01-03T00:00:00Z"),
  12.            ISODate("2015-01-04T00:00:00Z"),
  13.            ISODate("2015-01-05T00:00:00Z"),
  14.            ISODate("2015-01-06T00:00:00Z"),
  15.            ISODate("2015-01-07T00:00:00Z"),
  16.            ISODate("2015-01-08T00:00:00Z"),
  17.            ISODate("2015-01-09T00:00:00Z"),
  18.            ISODate("2015-01-10T00:00:00Z")
  19.         ]
  20. }
  21.    
  22. {
  23. "_id" : ObjectId("55474c322e8f6b5a9dda1a0f"),
  24. "dates" : [
  25.     ISODate("2015-01-01T00:00:00.000Z"),
  26.     ISODate("2015-01-02T00:00:00.000Z"),
  27.     ISODate("2015-01-03T00:00:00.000Z"),
  28.     ISODate("2015-01-04T00:00:00.000Z"),
  29.     ISODate("2015-01-05T00:00:00.000Z"),
  30.     ISODate("2015-01-06T00:00:00.000Z"),
  31.     ISODate("2015-01-07T00:00:00.000Z"),
  32.     ISODate("2015-01-08T00:00:00.000Z"),
  33.     ISODate("2015-01-09T00:00:00.000Z"),
  34.     ISODate("2015-01-10T00:00:00.000Z")
  35. ]
  36. }
  37.    
  38. //Example using subdocs
  39. {
  40. "_id" : ObjectId("55474e332e8f6b5a9dda1a10"),
  41. "dates" : [
  42.     {
  43.         "date" : ISODate("2015-01-01T00:00:00.000Z")
  44.     },
  45.     {
  46.         "date" : ISODate("2015-01-02T00:00:00.000Z")
  47.     },  
  48. ... etc
  49.  
  50.   //using embedded docs
  51.   db.rangeTest.find(
  52.  {'dates.date': {$gte:ISODate("2015-01-08T00:00:00.000Z"), $lte:ISODate("2015-01-09T00:00:00.000Z")}},
  53. {_id:0, 'dates.$':1} )
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top