A (very) thin wrapper on top of PyMongo CRUD functions in order to use some different query syntax. Another possible use is that the SimpleCRUDHandler class could be used as a base class for database models. Tested to work on Python 2.7, 3.3, 3.4, 3.5, pypy, and pypy3.
from pymongo import MongoClient as Client
posts = Client().blog.posts
results = posts.find_one({"title": "Moby Dick"})from mongous import SimpleMongoCRUDHandler as Handler
posts = Handler("blog", "posts")
results = posts.read(title="Moby Dick")$ pip install mongous
Alternatively, you can download the source code and install to your library:
$ python setup.py install
In some cases you might need to do this:
$ sudo python setup.py install
Constructor, sets database to database_name, collection to collection_name, and optionally uses the connection string connection if supplied.
returns the return value of PyMongo.MongoClient.insert_one with kwargs passed as a dict
returns the return value of PyMongo.MongoClient.insert_many with documents passed
returns the return value of PyMongo.MongoClient.find_one with kwargs passed as a dict
returns the return value of PyMongo.MongoClient.read_many with kwargs passed as a dict
returns the return value of PyMongo.MongoClient.update_many with doc and kwargs passed as dicts (the second argument being a blend of both doc and kwargs minus _id so you don't have to add everything manually to an update query)
returns the return value of PyMongo.MongoClient.delete_many with kwargs passed as a dict