Skip to main content

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.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pocket_mongo-0.0.2-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file pocket_mongo-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: pocket_mongo-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.3

File hashes

Hashes for pocket_mongo-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b80ca877e74093e0d372478e45a21a41fab9d435daf77d8870e2cbce02433d83
MD5 28f64fc6b1971d2da3867ae87c65b113
BLAKE2b-256 30b614054a3cf82f6f6fa2f0bc66df15810743bb00f0b729d4a47b31e993f19a

See more details on using hashes here.

Supported by

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