Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

An easy-to-use and quick setup interface for MongoDB.

Project description

Pocket Mongo

An easy-to-use and quick setup interface for MongoDB.

Pocket Mongo was build to help developers manage collections, and their methods, in a single class. Allows full access to pymongo API while offering customizable methods for implementing the business rules associated with the collection.

Getting Started

Installing

pip install pocket-mongo

Examples

Lets say you need a collection to store some cars informations:

from pocket_mongo import BaseCollection

class Cars(BaseCollection):
    collection_name = 'cars'

Cars.collection.insert_many([
    {
        'car': 'Ford Torino',
        'horsepower': 140.,
        'origin': 'US',
    },
    {
        'car': 'Volvo 145e',
        'horsepower': 112.,
        'origin': 'Europe',
    },
    {
        'car': 'Chevrolet Impala',
        'horsepower': 150.,
        'origin': 'US',
    },
])

Now you can implement methods to query, insert and perform aggregations on that collection:

class Cars(BaseCollection):
    collection_name = 'cars'

    @classmethod
    def get_us_only(cls) -> List[Dict]:
        return cls.collection.find({'origin': 'US'})

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pocket-mongo, version 0.0.2
Filename, size File type Python version Upload date Hashes
Filename, size pocket_mongo-0.0.2-py3-none-any.whl (5.5 kB) File type Wheel Python version py3 Upload date Hashes View hashes

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