mongo query as a predicate function
Project description
mgqpy
mongo query as a predicate function
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.9.tar.gz
(5.2 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.9.tar.gz.
File metadata
- Download URL: mgqpy-0.1.9.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15f258a634e725c42dd6b49be6e6411cfd874b080673add1f3c6c78d58c97fe1
|
|
| MD5 |
19edc3e017e8314cfcea7683dda501e9
|
|
| BLAKE2b-256 |
d2512b8e749484186b74980d0e86126fc7c454b581031bd26562eda273819217
|
File details
Details for the file mgqpy-0.1.9-py2.py3-none-any.whl.
File metadata
- Download URL: mgqpy-0.1.9-py2.py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
599529285835f15329f8072aa2f913eeb8c2b0176f39e5e5f14a53a49fdc54b2
|
|
| MD5 |
59077156cebdbd2a6bf434cef5c1006d
|
|
| BLAKE2b-256 |
f212492a8e39ae04478fb7ed3c6305cccf56ef788d3673f103c80e7a9e64c454
|