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

        Raises :class:`TypeError` if `collection` or `database` is not
        an instance of :class:`basestring` (:class:`str` in python 3).
        `database` is optional and allows references to documents to work
        across databases. Any additional keyword arguments will create
        additional fields in the resultant embedded document.

        :Parameters:
          - `collection`: name of the collection the document is stored in
          - `id`: the value of the document's ``"_id"`` field
          - `database` (optional): name of the database to reference
          - `**kwargs` (optional): additional keyword arguments will
            create additional, custom fields

        .. mongodoc:: dbrefs
Initialize a new :class:`DBRef`.
Initialize a new : class : DBRef .
def __init__(self, collection, id, database=None, _extra={}, **kwargs):
        """Initialize a new :class:`DBRef`.

        Raises :class:`TypeError` if `collection` or `database` is not
        an instance of :class:`basestring` (:class:`str` in python 3).
        `database` is optional and allows references to documents to work
        across databases. Any additional keyword arguments will create
        additional fields in the resultant embedded document.

        :Parameters:
          - `collection`: name of the collection the document is stored in
          - `id`: the value of the document's ``"_id"`` field
          - `database` (optional): name of the database to reference
          - `**kwargs` (optional): additional keyword arguments will
            create additional, custom fields

        .. mongodoc:: dbrefs
        """
        if not isinstance(collection, string_type):
            raise TypeError("collection must be an "
                            "instance of %s" % string_type.__name__)
        if database is not None and not isinstance(database, string_type):
            raise TypeError("database must be an "
                            "instance of %s" % string_type.__name__)

        self.__collection = collection
        self.__id = id
        self.__database = database
        kwargs.update(_extra)
        self.__kwargs = kwargs
def __init__ ( self , collection , id , database = None , _extra = { } , * * kwargs ) : if not isinstance ( collection , string_type ) : raise TypeError ( "collection must be an " "instance of %s" % string_type . __name__ ) if database is not None and not isinstance ( database , string_type ) : raise TypeError ( "database must be an " "instance of %s" % string_type . __name__ ) self . __collection = collection self . __id = id self . __database = database kwargs . update ( _extra ) self . __kwargs = kwargs