dbref – Tools for manipulating DBRefs (references to documents stored in MongoDB)

    • class DBRef(collection, id, database=None, _extra={}, **kwargs)
    • Initialize a new .

    Raises if collection or database is notan instance of basestring ( in python 3).database is optional and allows references to documents to workacross databases. Any additional keyword arguments will createadditional fields in the resultant embedded document.

    Parameters:

    • collection: name of the collection the document is stored in
    • id: the value of the document’s field
    • **kwargs (optional): additional keyword arguments willcreate additional, custom fields

    The MongoDB documentation on

    dbrefs

    • as_doc()
    • Get the SON document representation of this DBRef.
    • collection
    • Get the name of this DBRef’s database.
    • id
    • Get this DBRef’s _id.