ondrejsika.com

mongo-server documentation

HTTP server for MongoDB

Authors

Ondrej Sika ondrejsika.com dev@ondrejsika.com

Source

Documentation ondrejsika.com/docs/mongo-server
Python Package Index pypi.python.org/pypi/mongo-server
GitHub github.com/sikaondrej/mongo-server

Instalation

Instalation is very simple over pip.
# pip install mongo-server

Create mongo server

file wsgi.py
from mongo_server import MongoServer

application = MongoServer(database="database", table="data", server=None, port=None)
if __name__ == "__main__":
    application.run()

Run server

$ python wsgi.py
* Running on http://127.0.0.1:5000/
or
$ gunicorn wsgi:application

Usage

Insert data

Inser to default table
HTTP GET http://localhost:5000/insert/?a=1&b=2
insert to other table
HTTP GET http://localhost:5000/insert/my_table/?a=1&b=2

Get data

Find in default table
HTTP GET http://localhost:5000/find/?a=1
[{ u'a': [u'1'], u'b': [u'2'], u'_id': ObjectId('5153178a0fa47060817b9320')}]
Find in other table
HTTP GET http://localhost:5000/find/my_table/?a=1
[{ u'a': [u'1'], u'b': [u'2'], u'_id': ObjectId('5153178a0fa47060817b9320')}]