| def bson.BSON.decode | ( |  | self, | 
        
          |  |  |  | as_class = dict, | 
        
          |  |  |  | tz_aware = False, | 
        
          |  |  |  | uuid_subtype = OLD_UUID_SUBTYPE, | 
        
          |  |  |  | compile_re = True | 
        
          |  | ) |  |  | 
      
 
Decode this BSON data.
The default type to use for the resultant document is
:class:`dict`. Any other class that supports
:meth:`__setitem__` can be used instead by passing it as the
`as_class` parameter.
If `tz_aware` is ``True`` (recommended), any
:class:`~datetime.datetime` instances returned will be
timezone-aware, with their timezone set to
:attr:`bson.tz_util.utc`. Otherwise (default), all
:class:`~datetime.datetime` instances will be naive (but
contain UTC).
:Parameters:
  - `as_class` (optional): the class to use for the resulting
    document
  - `tz_aware` (optional): if ``True``, return timezone-aware
    :class:`~datetime.datetime` instances
  - `compile_re` (optional): if ``False``, don't attempt to compile
    BSON regular expressions into Python regular expressions. Return
    instances of
    :class:`~bson.regex.Regex` instead. Can avoid
    :exc:`~bson.errors.InvalidBSON` errors when receiving
    Python-incompatible regular expressions, for example from
    ``currentOp``
.. versionchanged:: 2.7
   Added ``compile_re`` option.
.. versionadded:: 1.9
 
 
 
      
        
          | def bson.BSON.encode | ( |  | cls, | 
        
          |  |  |  | document, | 
        
          |  |  |  | check_keys = False, | 
        
          |  |  |  | uuid_subtype = OLD_UUID_SUBTYPE | 
        
          |  | ) |  |  | 
      
 
Encode a document to a new :class:`BSON` instance.
A document can be any mapping type (like :class:`dict`).
Raises :class:`TypeError` if `document` is not a mapping type,
or contains keys that are not instances of
:class:`basestring` (:class:`str` in python 3). Raises
:class:`~bson.errors.InvalidDocument` if `document` cannot be
converted to :class:`BSON`.
:Parameters:
  - `document`: mapping type representing a document
  - `check_keys` (optional): check if keys start with '$' or
    contain '.', raising :class:`~bson.errors.InvalidDocument` in
    either case
.. versionadded:: 1.9
 
 
 
The documentation for this class was generated from the following file:
- /var/lib/jenkins/workspace/compile_db_x86_branch_2.6/sequoiadb/driver/python/bson/__init__.py