Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- > db.activities.find()
- { "_id" : ObjectId("4cd8a3d15c5973397c000027"), "extra" : { "public" : true }, "time" : 1289266129.758516, "actor" : "user", "user" : "4cd714cd5c59731c7a000025", "criteria" : "instance", "message" : [
- {
- "display" : "",
- "id" : "4cd714cd5c59731c7a000025",
- "entity" : "user"
- },
- {
- "display" : "just created a otherstuff called",
- "entity" : "text"
- },
- {
- "display" : "",
- "id" : "4cd8a3d15c5973397c000025",
- "entity" : "otherstuff"
- }
- ], "type" : "otherstuffs.created" }
- { "_id" : ObjectId("4cd8a3d35c5973397c00002a"), "extra" : { "public" : true }, "time" : 1289266131.998971, "actor" : "user", "user" : "4cd714cd5c59731c7a000025", "criteria" : "instance", "message" : [
- {
- "display" : "",
- "id" : "4cd714cd5c59731c7a000025",
- "entity" : "user"
- },
- {
- "display" : "is a otherstuff creation machine - now we have otherstuff",
- "entity" : "text"
- },
- {
- "display" : "",
- "id" : "4cd8a3d35c5973397c000028",
- "entity" : "otherstuff"
- }
- ], "type" : "otherstuffs.created" }
- > db.activities.getIndexes()
- [
- {
- "name" : "_id_",
- "ns" : "realdeal.activities",
- "key" : {
- "_id" : 1
- }
- },
- {
- "_id" : ObjectId("4cd8a586e2c8302e52577808"),
- "ns" : "realdeal.activities",
- "key" : {
- "user" : 1,
- "actor" : 1,
- "extra.public" : 1,
- "time" : -1
- },
- "name" : "user_1_actor_1_extra.public_1_time_-1"
- }
- ]
- Here is the query... (which I run via PyMongo)...
- {'$or': [{'extra.public': True}, {'extra.otherstuff': {'$in': []}, 'extra.public': False}, {'extra.otherstuff': {'$in': [u'4cd8a3d15c5973397c000025', u'4cd8a3d35c5973397c000028']}, 'extra.public':
- False}, {'extra.otherstuff': {'$in': []}, 'extra.public': False}], 'user': {'$in': []}, 'actor': 'user'}
- Here is the sort order...
- [('time', -1)]
- Here is the explain output...
- {u'allPlans': [{u'cursor': u'BasicCursor', u'indexBounds': {}}], u'millis': 0,
- u'n': 0, u'cursor': u'BasicCursor', u'indexBounds': {}, u'nscannedObjects': 0, u'nscanned': 0}
Add Comment
Please, Sign In to add comment