PYMONGO(3)

NAME
pymongo - Python interface for MongoDB

SYNOPSIS
pymongo

DESCRIPTION
This manual page documents briefly the pymongo python library.

USAGE
Assuming that a running instance of MongoDB is available, setup a connection to the daemon: >>> from pymongo import Connection
>>> connection = Connection('localhost', 27017) If you are happy with the default values (localhost) you can simply use Connection()
A single instance of MongoDB can support multiple independent databases. Select the database you want to use: >>> db = connection.test_database You can use dictionary-style access instead: >>> db = connection['test-database'] A collection is a group of documents stored in MongoDB, a bit like a table in a relational database.
Get a collection: >>> collection = db.test_collection
Or:
>>> collection = db['test-collection'] Warning: Collections and databases are created when the first document is inserted into them.
Example of data insertion: >>> item = {"author": "Me","title": "This is a test"} >>> collection.insert(item) Comprehensive documentation can be found at:
http://api.mongodb.org/python/

AUTHOR
pymongo was written by Mike Dirolf.

This manual page was written by Federico Ceratto <federico.ceratto@gmail.com>, for the Debian project (and may be used by others).