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
- $regex (implicit), e.g.
{"foo": re.compile('^bar')} - $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.5.0.tar.gz
(56.3 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.5.0.tar.gz.
File metadata
- Download URL: mgqpy-0.5.0.tar.gz
- Upload date:
- Size: 56.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04434a560ec0377f628cfd9093559e739f5f4e30c01ac49c85c882489558965e
|
|
| MD5 |
c5d0b8c24bda131d8831afebece7b0d1
|
|
| BLAKE2b-256 |
1a690f790ef09224e0e47f3c2649a4627ccf40105aa2fc4810de3fa2e1ec67c7
|
File details
Details for the file mgqpy-0.5.0-py2.py3-none-any.whl.
File metadata
- Download URL: mgqpy-0.5.0-py2.py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff23b1423ffa49019e1b5cc817fcf6c45163d6c3ec3b5227a4ed0c00a2cb1c9b
|
|
| MD5 |
9c65f168bfe708485e2c546dd2270b58
|
|
| BLAKE2b-256 |
8341d252385e8c830d5e3c80898554d6476c01d8b5e35a16f964a45709674d45
|