A utility library that provides a MongoDB-like query language for querying Python collections, especially lists of dicts from JSON or YAML parsers. Current version is 1.4.3. Releases are infrequent; the last release was around 2019.
pip install mongoqueryVerified import paths — ran on the pinned version, not inferred.
Basic usage: create a Query with a MongoDB-like filter and call .match() on a list of dicts.
Use re.compile(r'pattern') directly as a value, or use string with '$regex' key in dict structure.
Ensure input data is a list of dicts-like structures. For objects, use __dict__ or convert to dict first.
Review MongoDB documentation for $elemMatch semantics and test with your data.
Wrap single dict in a list: q.match([my_dict]) or use q.match(my_dict) only if my_dict is itself a list.
For regex matching, use compiled regex: q = Query({'field': re.compile(r'pattern')}) or use dict: q = Query({'field': {'$regex': 'pattern'}}).No dependency data recorded yet.