3 ms·
I far prefer the MongoDB query syntax which is a JSON object. For example to find all last name smith you use {"last_name": "smith"}. To also find year less t
by rogerbinns 13y ago
I far prefer the MongoDB query syntax which is a JSON object. For example to find all last name smith you use {"last_name": "smith"}. To also find year less than 2001 {"last_name": "smith", "year": {"$lt": 2001}}.
Since dictionaries are first class objects in Python this is very easy to work with. Accepting extras from the command line is an example:
query={"last_name": "smith", "year": {"$lt": 2001}}
query.update(json.loads(argv))
They do use the chaining for the non-query values bit (sort order, limits etc).