Skip to main content

A flat file drop in replacement for mongodb. Requires Tinydb

Project description

This module is to attempt to add support for mongodb old and newer versions. Currently I have tested side by side with version 3.2.4 of pymongo for this version.

Install

$ easy_install tinymongo
$ pip install tinymongo

Usage

# you can include a folder name as a parameter if not it will default to "tinydb"
tinyClient = TinyMongoClient()

# either creates a new database file or accesses an existing one
tinyDatabase = tinyClient.tinyDatabase

# either creates a new collection or accesses an existing one
tinyCollection = tinyDatabase.tinyCollection

#insert data adds a new record returns _id
recordId = tinyCollection.insert_one({"username":"admin","password":"admin","module":"somemodule"})
userInfo = tinyCollection.find_one({"_id":recordId})  # returns the record inserted

#update data returns True if successful and False if unsuccessful
upd = table.update_one({"username":"admin"},{"$set":{"module":"someothermodule"})

I will also be adding support for gridFS by storing the files somehow and indexing them in a db like mongo currently does

More to come……

License

MIT License

Project details


Supported by

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