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.11.tar.gz
(5.0 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.11.tar.gz.
File metadata
- Download URL: mgqpy-0.1.11.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02ffca5a56002166dabfb974e2815b9f220e2c0d605303a1763a53a4f9cf6d3a
|
|
| MD5 |
d240f9040dfd7c11224e9480703717c7
|
|
| BLAKE2b-256 |
2f3d7fb0f3e4df805ebe12a3db6352e5dca2820df5628878465bb9b3743831ed
|
File details
Details for the file mgqpy-0.1.11-py2.py3-none-any.whl.
File metadata
- Download URL: mgqpy-0.1.11-py2.py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f4bfee8b2bc9ee14ae5c1e24278ebc130e2691126a873035ecf0532403e440b4
|
|
| MD5 |
d72aa4477bcbde80e02af0caa0aa6d75
|
|
| BLAKE2b-256 |
29ce822e238de6069df7865197e24b1f5aa5d05b5ffcc4537a09ea0d8f702ff2
|