A toolcase with utilities for mongoDB
based mainly on pymongo
useful also as mongoDB example usage and best practices.
This library has been in developement as pymongo_ext
until major changes in pymongo version 3 broke backward compatibility, it is now rewrittern from scratch.
Note
- detailed documentation
- github repository
- for any bugs/suggestions feel free to issue a ticket in github's issues
Installation: | pip install mongoUtils |
---|
Dependencies: |
|
---|
Usage: | See documentation of individual modules and classes
All examples require the existance of testing database and collections which are installed during execution of tests.
Also if mongoDB is not running on local host port 27017, testDbConStr connection string in configuration.py should be edited.
Most examples require establishing a connection to testing database.
>>> from pymongo import MongoClient; # import MongoClient
>>> from mongoUtils.client import muClient # or alternativly this client
>>> from mongoUtils.configuration import testDbConStr # import conection string
>>> client = muClient(testDbConStr) # establish a client connection
>>> db = client.get_default_database() # get test database |
---|
Tests: |
|
---|