Created
September 30, 2015 22:45
-
-
Save lega911/a7d17a844af5cc45afbe to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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