Skip to main content

MongoDB utilities for Python

Project description

PyPI-Status PyPI-Versions Build-Status Codecov LICENCE

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).

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

mongozen-0.0.6.tar.gz (58.4 kB view details)

Uploaded Source

Built Distribution

mongozen-0.0.6-py2.py3-none-any.whl (56.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file mongozen-0.0.6.tar.gz.

File metadata

  • Download URL: mongozen-0.0.6.tar.gz
  • Upload date:
  • Size: 58.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for mongozen-0.0.6.tar.gz
Algorithm Hash digest
SHA256 8d9395f76b8bfe99733bcfbc76fd7a4e3ad491275ac8e0028bba4c21acb99471
MD5 59fb138f83fa44ead478baa6b7ec6b37
BLAKE2b-256 5d8f0cb3f81eef1045cfd4a34657370331a8a19437f57052a73ed45fe7541e6f

See more details on using hashes here.

File details

Details for the file mongozen-0.0.6-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for mongozen-0.0.6-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 74d67f5c51f773d77dcaaa1765f40debcfd736ea65efb5c0d050b2dce71db5aa
MD5 ac4ec57887d96e5ee09f2c1fd38dfea9
BLAKE2b-256 be9956ae66982a21bbb56fd4f844919eca8f2b4667048809d89c8627e378ccd9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page