Skip to main content

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.

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bottle-mongo-0.2.2.tar.gz (3.2 kB view details)

Uploaded Source

File details

Details for the file bottle-mongo-0.2.2.tar.gz.

File metadata

File hashes

Hashes for bottle-mongo-0.2.2.tar.gz
Algorithm Hash digest
SHA256 8e59c05e2415895db95f24d5b4ab16125730f94964396646d59328323261c36e
MD5 38bd8767b25a9542507f7e567dea1942
BLAKE2b-256 ab9175daa3e34e2d49019f7027b67609ce27f4cf19242ab59fa6d0d316e005b7

See more details on using hashes here.

Provenance

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