Guest User

Untitled

a guest
Aug 17th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.54 KB | None | 0 0
  1. > db.activities.find()
  2. { "_id" : ObjectId("4cd8a3d15c5973397c000027"), "extra" : { "public" : true }, "time" : 1289266129.758516, "actor" : "user", "user" : "4cd714cd5c59731c7a000025", "criteria" : "instance", "message" : [
  3. {
  4. "display" : "",
  5. "id" : "4cd714cd5c59731c7a000025",
  6. "entity" : "user"
  7. },
  8. {
  9. "display" : "just created a otherstuff called",
  10. "entity" : "text"
  11. },
  12. {
  13. "display" : "",
  14. "id" : "4cd8a3d15c5973397c000025",
  15. "entity" : "otherstuff"
  16. }
  17. ], "type" : "otherstuffs.created" }
  18. { "_id" : ObjectId("4cd8a3d35c5973397c00002a"), "extra" : { "public" : true }, "time" : 1289266131.998971, "actor" : "user", "user" : "4cd714cd5c59731c7a000025", "criteria" : "instance", "message" : [
  19. {
  20. "display" : "",
  21. "id" : "4cd714cd5c59731c7a000025",
  22. "entity" : "user"
  23. },
  24. {
  25. "display" : "is a otherstuff creation machine - now we have otherstuff",
  26. "entity" : "text"
  27. },
  28. {
  29. "display" : "",
  30. "id" : "4cd8a3d35c5973397c000028",
  31. "entity" : "otherstuff"
  32. }
  33. ], "type" : "otherstuffs.created" }
  34.  
  35. > db.activities.getIndexes()
  36. [
  37. {
  38. "name" : "_id_",
  39. "ns" : "realdeal.activities",
  40. "key" : {
  41. "_id" : 1
  42. }
  43. },
  44. {
  45. "_id" : ObjectId("4cd8a586e2c8302e52577808"),
  46. "ns" : "realdeal.activities",
  47.  
  48. "key" : {
  49. "user" : 1,
  50. "actor" : 1,
  51. "extra.public" : 1,
  52. "time" : -1
  53. },
  54. "name" : "user_1_actor_1_extra.public_1_time_-1"
  55. }
  56. ]
  57.  
  58. Here is the query... (which I run via PyMongo)...
  59.  
  60. {'$or': [{'extra.public': True}, {'extra.otherstuff': {'$in': []}, 'extra.public': False}, {'extra.otherstuff': {'$in': [u'4cd8a3d15c5973397c000025', u'4cd8a3d35c5973397c000028']}, 'extra.public':
  61. False}, {'extra.otherstuff': {'$in': []}, 'extra.public': False}], 'user': {'$in': []}, 'actor': 'user'}
  62.  
  63. Here is the sort order...
  64.  
  65. [('time', -1)]
  66.  
  67. Here is the explain output...
  68.  
  69. {u'allPlans': [{u'cursor': u'BasicCursor', u'indexBounds': {}}], u'millis': 0,
  70. u'n': 0, u'cursor': u'BasicCursor', u'indexBounds': {}, u'nscannedObjects': 0, u'nscanned': 0}
Add Comment
Please, Sign In to add comment