Created
October 10, 2014 13:18
-
-
Save ybv/441e7b42841edb3f3551 to your computer and use it in GitHub Desktop.
pymongo query builder for '$or' & '$and' with lists, dicts and conditions
This file contains 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
{'$or': [ {'$and':[ dict(zip(keys, triple.split(':')))] } if '0' not in triple else {'$and':[ dict(zip(keys, triple.split(':')[:2]))] } for triple in termstr ]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
woo