Skip to content

Instantly share code, notes, and snippets.

@lega911
Created September 30, 2015 22:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lega911/a7d17a844af5cc45afbe to your computer and use it in GitHub Desktop.
Save lega911/a7d17a844af5cc45afbe to your computer and use it in GitHub Desktop.
def mongo(filter):
result = list(db.user.find({'name': {'$gt': filter}}).sort('name').limit(100))
parents = set()
for d in result:
parents.add(d['parent'])
parents = db.user.find({'_id': {'$in': list(parents)}})
assert len(result) == 100
def orient(filter):
q = 'select name, parent.name from User where name > "{}" order by name limit 100'.format(filter)
result = client.query(q)
assert len(result) == 100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment