Skip to content

A simple wrapper to make a flat file drop in replacement for mongodb out of TinyDB

License

Notifications You must be signed in to change notification settings

jjonesAtMoog/tinymongo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

  • Master Branch Build Status
  • Develop Branch Build Status

Purpose

A simple wrapper to make a drop in replacement for mongodb out of tinydb. This module is an attempt to add an interface familiar to those currently using pymongo.

Status

Unit testing is currently being worked on and functionality is being added to the library. Current coverage is 93%. Current builds tested on Python versions 2.7 and 3.3+.

Installation

The latest release can be installed via pip install tinymongo. The library is currently under rapid development and a more recent version may be desired. In this case, simply clone this repository, navigate to the root project directory, and python setup.py install. This is a pure python distribution and - thus - should require no external compilers or tools besides those contained within Python itself.

Examples

The quick start is shown below. For a more detailed look at tinymongo, take a look at demo.py within the repository.

from tinymongo import *

# 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

# returns a list of all users of 'module'
users = tinyCollection.find({'module': 'module'})

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

Contributions

Contributions are welcome! Currently, the most valuable contributions would be:

  • adding test cases
  • adding functionality consistent with pymongo
  • documentation
  • identifying bugs and issues

Future Development

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

About

A simple wrapper to make a flat file drop in replacement for mongodb out of TinyDB

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%