mongo query as a python filter predicate
Project description
mgqpy
mongo query as a python filter predicate
pip install mgqpy
from mgqpy import Query
predicate = Query({"foo.bar": 1})
inputs = [
{"foo": [{"bar": [1]}]},
{"foo": {"bar": 1}},
{"foo": None},
]
filtered = filter(predicate.match, inputs)
assert list(filtered) == [
{"foo": [{"bar": [1]}]},
{"foo": {"bar": 1}},
]
Supported operators
Comparison query operators
- $eq
- $eq (implicit), e.g.
{"foo": None} - $ne
- $gt
- $gte
- $lt
- $lte
- $in
- $nin
Logical query operators
- $and
- $and (implicit), e.g.
{"foo": 1, "bar": "baz"} - $or
- $not
- $nor
Evaluation query operators
- $regex
- $mod
Array query operators
- $all
- $elemMatch
- $size
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mgqpy-0.1.8.tar.gz
(4.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mgqpy-0.1.8.tar.gz.
File metadata
- Download URL: mgqpy-0.1.8.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
645eaae1af36bf4c87e15aabf4b6c65cb092209494f9e9f0f0406ce34f917d1d
|
|
| MD5 |
55f5fb59ee1b929d6d62a373c1a29c3a
|
|
| BLAKE2b-256 |
6db59196bef1576094aae0b69014d5485b79be9567c70d5c6aae3818e4dee79b
|
File details
Details for the file mgqpy-0.1.8-py2.py3-none-any.whl.
File metadata
- Download URL: mgqpy-0.1.8-py2.py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0fa020ca69d76bb596cb7dcfde628990568fc8c75e0923b9d37bb94143c98644
|
|
| MD5 |
2ae192edc65c9afa3767e0d2ef2329c2
|
|
| BLAKE2b-256 |
1a5500985426c1603787c53a7102ef39a55d1a119beb704130744e02b4c77c41
|