MongoDB utilities for Python.
from mongozen.util import export_collection
export_collection(collection_obj, '~/dump.json')
1 Installation
pip install mongozen
2 Use
mongozen is divided into three sub-packages, by functionality:
2.1 matchop
Defines a Matchop class representing a pymongo matching operator. It extends the standard Python dict, provides a smart representation of a MongoDB matching operator with well-defined and optimized & and | operators. For example:
from mongozen.matchop import Matchop
match_dateint = Matchop({'dateInt': {'$gt': 20161203}})
match_dateint_and_id = match_dateint & {'user_id': 12}
print(match_dateint_and_id)
will output
{'user_id': 12, 'dateInt': {'$gt': 20161203}}
While
match_dateint = Matchop({'dateInt': {'$gt': 20161203}})
match_dateint_updated = match_dateint & {'dateInt': {'$gt': 20161208}}
print(match_dateint_updated)
will output
{ {'dateInt': {'$gt': 20161208}} }
2.2 queries
Contains some usefull queries.
2.3 util
Contains utility functions, like Python wrappers for MongoDB command-line tools.
3 Contributing
Package author and current maintainer is Shay Palachy (shay.palachy@gmail.com); You are more than welcome to approach him for help. Contributions are very welcomed.
3.1 Installing for development
Clone:
git clone git@github.com:shaypal5/mongozen.git
Install in development mode:
cd mongozen
pip install -e .[test]
# or, if you use pipenv
pipenv install --dev
3.2 Running the tests
To run the tests use:
pytest
# or, if you use pipenv
pipenv run pytest
3.3 Adding documentation
The project is documented using the numpy docstring conventions, which were chosen as they are perhaps the most widely-spread conventions that are both supported by common tools such as Sphinx and result in human-readable docstrings. When documenting code you add to this project, follow these conventions.
Additionally, if you update this README.rst file, use python setup.py checkdocs (or pipenv run the same command) to validate it compiles.
4 Credits
Created by Shay Palachy (shay.palachy@gmail.com).
Metadata
Release files for mongozen 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mongozen-0.0.6.tar.gz | 58.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mongozen-0.0.6-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 115.0 kB
Release files / mongozen-0.0.6.tar.gz
| Download URL | mongozen-0.0.6.tar.gz |
|---|---|
| Size | 58.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8d9395f76b8bfe99733bcfbc76fd7a4e3ad491275ac8e0028bba4c21acb99471
|
|
BLAKE2b-256 checksum How to use checksums |
5d8f0cb3f81eef1045cfd4a34657370331a8a19437f57052a73ed45fe7541e6f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / mongozen-0.0.6-py2.py3-none-any.whl
| Download URL | mongozen-0.0.6-py2.py3-none-any.whl |
|---|---|
| Size | 56.6 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
74d67f5c51f773d77dcaaa1765f40debcfd736ea65efb5c0d050b2dce71db5aa
|
|
BLAKE2b-256 checksum How to use checksums |
be9956ae66982a21bbb56fd4f844919eca8f2b4667048809d89c8627e378ccd9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |