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("/")
Release files for bottle-mongo 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bottle-mongo-0.3.0.tar.gz | 3.5 kB | Details |
Release files / bottle-mongo-0.3.0.tar.gz
| Download URL | bottle-mongo-0.3.0.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
902bfad1ce40ff592507a717902e2b3f33a436ad14dcbe29d1f50f97bb45450f
|
|
BLAKE2b-256 checksum How to use checksums |
c4b80310a7cfe93b1bedb1c12df1c281ec00d865054eaadeffdbab8b44a05680
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |