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.

Filename, size & hash SHA256 hash help File type Python version Upload date
mongozen-0.0.6-py2.py3-none-any.whl (56.6 kB) Copy SHA256 hash SHA256 Wheel 3.6
mongozen-0.0.6.tar.gz (58.4 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page