MongoDB integration for Bottle
Project description
This bottle-mongodb plugin integrates MongoDB with your Bottle application. It injects a MongoDB session in your route and handle the session cycle.
Support pymongo 3 and 2
Usage Example:
from bottle import Bottle ,redirect from bottle.ext.mongo import MongoPlugin from bson.json_util import dumps app = Bottle() plugin = MongoPlugin(uri="mongodb://127.0.0.1", db="mydb", json_mongo=True) app.install(plugin) @app.route('/', method='GET') def index(mongodb): return dumps(mongodb['collection'].find()) @app.route('/create/', method='POST') def create(mongodb): mongodb['collection'].insert({'a': 1, 'b': 2}) redirect("/")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size bottle-mongo-0.3.0.tar.gz (3.5 kB) | File type Source | Python version None | Upload date | Hashes View |