Advertisement
Guest User

Untitled

a guest
May 25th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. $subset = $db->col->find(
  2. array(
  3. 'timestamps'=> array(
  4. '$elemMatch'=> array(
  5. '$gte'=> new MongoDate(strtotime('2016-05-25 13:00:00')),
  6. '$lte'=> new MongoDate(strtotime('2016-05-25 14:00:00'))
  7. )
  8. )
  9. )
  10. );
  11.  
  12. {
  13. "month": {
  14. "$date": 1464134400000
  15. },
  16. "timestamps": [
  17. {
  18. "$date": 1464181803000
  19. },
  20. {
  21. "$date": 1464182103000
  22. },
  23. {
  24. "$date": 1464182403000
  25. },
  26. {
  27. "$date": 1464183003000
  28. },
  29. {
  30. "$date": 1464183603000
  31. },
  32. {
  33. "$date": 1464184203000
  34. },
  35. {
  36. "$date": 1464184803000
  37. },
  38. {
  39. "$date": 1464185403000
  40. },
  41. {
  42. "$date": 1464186003000
  43. }
  44. ],
  45. "status_history": [
  46. 1,
  47. 1,
  48. 1,
  49. 0,
  50. 1,
  51. 1,
  52. 1,
  53. 0,
  54. 1
  55. ],
  56. "_id": 12345
  57. }
  58.  
  59. db.Collection.find({
  60. created_at : {
  61. '$gte': new Timestamp(new Date(2012, 0, 21), 0),
  62. '$lte': new Timestamp(new Date(2012, 0, 22), 0)
  63. }
  64. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement