Skip to main content

MongoDB-backed Python dict-like interface

Project description

So you are storing some key-values in a dict but your data became huge than your memory or you want to persist it on the disk? Then mongodict is for you!

As it uses MongoDB to store the data, you get all cool MongoDB things, like shardings and replicas.

Installation

As simple as:

pip install mongodict

or:

easy_install mongodict

Usage

As it uses collections.MutableMapping as its base, you just need to change the line which creates your dict. For instace, just replace:

>>> my_dict = {}

with:

>>> from mongodict import MongoDict
>>> my_dict = MongoDict(host='localhost', port=27017, database='my_dict',
                        collection='store')

and then use it like a normal dict:

>>> my_dict['python'] = 'rules'
>>> print my_dict['python']
'rules'
>>> del my_dict['python']
>>> print my_dict['python']
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "mongodict.py", line 23, in __getitem__
    raise KeyError
KeyError

Enjoy! :-)

Author

This software was written and is maintained by Álvaro Justen (aka Turicas). Please contact me at alvarojusten at gmail dot com.

Semantic Versioning

This software uses Semantic Versioning.

License

It’s licensed under GPL version 3.

Project details


Download files

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

Source Distribution

mongodict-0.1.0.tar.gz (14.7 kB view details)

Uploaded Source

File details

Details for the file mongodict-0.1.0.tar.gz.

File metadata

  • Download URL: mongodict-0.1.0.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for mongodict-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1d53574b95baa69fe05fb2cc6cdbc931a039ea275cf7d0faa509e0eeb876bf7e
MD5 7822cfe0339737a0552449782c811e4c
BLAKE2b-256 5cc2cf37dd827b8941daa978605003439f78be22cc7d3ef89da37742e453fa37

See more details on using hashes here.

Supported by

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