mongo query as a python filter predicate
Project description
mgqpy
mongo query as a python filter predicate
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.7.tar.gz
(4.4 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.7.tar.gz.
File metadata
- Download URL: mgqpy-0.1.7.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
300c7730d35a8eaf7b06804f376054bc6d7c275d1c3251182fbe10efb4797d4b
|
|
| MD5 |
ba25559ec58f12f4c4ac02295a5f2af0
|
|
| BLAKE2b-256 |
964922e3f102dcba0d2f903eb0c45e90f732c35ea83537900a255290fd60c2d0
|
File details
Details for the file mgqpy-0.1.7-py2.py3-none-any.whl.
File metadata
- Download URL: mgqpy-0.1.7-py2.py3-none-any.whl
- Upload date:
- Size: 3.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e2e7603548c061dea9925098a77b7e19fd9dfc241cdf963514139017c921731
|
|
| MD5 |
a4a5328bb432239da1015b7e5bc8027b
|
|
| BLAKE2b-256 |
2e7055325dc5d42333a6de32a7dd453cd386041d9f7f7bc62d3b3a0833893198
|