Mongo Filter for ReferenceField - EmbeddedDocumentField
Project description
Project description
Mongo Filter
Permite filtrar multiples objetos de primer nivel de tipo Embebido y 1 de tipo RefenceField, apartir de un dict agregando como primera palabra el nombre del modelo seguido del campo de busqueda, modeloA_campo_busqueda.
Parametros:
principal_models: Modelo que contiene las referencias y embebidos
refence_models: Modelo RefenceField
params: dict con keys de filtros
Ejemplo:
model_a:
{
"id": 1,
"name": "abc",
"nid": "12323",
"addres": EmbeddedDocumentField(model_b),
"nid_type": ReferenceField(model_c, dbref=True)
}
model_b:
[
{
"id": 1,
"name": "cll qwer",
"description": "
},
{
"id": 2,
"name": "cll abc",
"description": "
}
]
model_c:
{
{
"id": 1,
"name": "C.C",
"description": "
},
{
"id": 2,
"name": "C.E",
"description": "
}
}
Params:
{
"id": 1,
"model_b_name": "cll abc",
"model_c_name": "C.C"
}
zmongo.queryset(model_a, model_c, Params)
repuesta:
{
"id": 1,
"name": "",
"addres": [addres[0]],
"nid_type": (object)
}
Installation
If you're running python3 on most systems, you can install the package with the following command:
pip3 install zmongo-filter
Usage
zmongo.queryset(model_a, model_c, Params)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
zmongo-filter-0.0.4.tar.gz
(4.4 kB
view hashes)
Built Distribution
Close
Hashes for zmongo_filter-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4bb3daa3625603b13c19cceab431167205fa9cbb522adaa10476ee533974bbb9 |
|
MD5 | a4fd94aabad6d40dc5d0fd71da47f88a |
|
BLAKE2b-256 | c137e414fb7b697146f22928151a7f79dfa8ed0194e2270eac34e5fcc19ae8e0 |