The connection to MongoDB

Overview

The connection module is not intended to be part of the public API for django-audit, but you may find it helpful if you want to perform some custom work on the auditing collection as such just the API documentation is included here.

API Documentation

class djangoaudit.connection.MongoConnection(host, port)

A wrapper around PyMongo’s connection to MongoDB

connect()

Make the connection to MongoDB.

database

Retrieve the default database based on Django settings.

Initially a lookup is performed and thereafter the cached database is returned.

Return type:<pending_xref py:class=”MongoConnection” py:module=”djangoaudit.connection” refdoc=”connection” refdomain=”py” refexplicit=”False” reftarget=”pymongo.database.Database” reftype=”class”><literal classes=”xref py py-class”>pymongo.database.Database</literal></pending_xref>
get_collection(collection_name)

Get the collection specified by collection_name

Parameters:
  • collection_name (basestring) – The name of the collection to use
Return type:

<pending_xref py:class=”MongoConnection” py:module=”djangoaudit.connection” refdoc=”connection” refdomain=”py” refexplicit=”False” reftarget=”pymongo.collection.Collection” reftype=”class”><literal classes=”xref py py-class”>pymongo.collection.Collection</literal></pending_xref>

djangoaudit.connection.MONGO_CONNECTION

This module level variable should be the only thing that is imported as it sets up the connection to MongoDB based on the django settings.

Table Of Contents

Previous topic

Working with forms

This Page