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.2.0.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.2.0.tar.gz.
File metadata
- Download URL: mgqpy-0.2.0.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 |
8225dd5af4c3a2aaa76a48fee8ea481f192973d25c22d689b96444af645c30d3
|
|
| MD5 |
16c5bd62b4994aff16e5ec0fa551e70c
|
|
| BLAKE2b-256 |
75bdea402bd96e696d331fb8d01e2e93fbfa64c778a37355ad6d603f2737daa7
|
File details
Details for the file mgqpy-0.2.0-py2.py3-none-any.whl.
File metadata
- Download URL: mgqpy-0.2.0-py2.py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6bcaa986c846701c2f7369845ec38631abb55a0cc560195bb81413edbe115a0b
|
|
| MD5 |
ecd00ced38fca5bbaabd1fd6c5d6dc13
|
|
| BLAKE2b-256 |
6e0f0b1748aa357a95fc1c8d4c2e44530b607a687ff61ea35f190ef26e206933
|