bson::son::SON Class Reference

List of all members.

Public Member Functions

def __cmp__
def __contains__
def __deepcopy__
def __delitem__
def __init__
def __iter__
def __len__
def __repr__
def __setitem__
def clear
def copy
def get
def has_key
def items
def iteritems
def iterkeys
def itervalues
def keys
def pop
def popitem
def setdefault
def to_dict
def update
def values

Private Attributes

 __keys

Detailed Description

SON data.

A subclass of dict that maintains ordering of keys and provides a
few extra niceties for dealing with SON. SON objects can be
converted to and from BSON.

The mapping from Python types to BSON types is as follows:

===================================  =============  ===================
Python Type                          BSON Type      Supported Direction
===================================  =============  ===================
None                                 null           both
bool                                 boolean        both
int                                  number (int)   both
float                                number (real)  both
string                               string         py -> bson
unicode                              string         both
list                                 array          both
dict / `SON`                         object         both
datetime.datetime [#dt]_ [#dt2]_     date           both
compiled re                          regex          both
`bson.binary.Binary`                 binary         both
`bson.objectid.ObjectId`             oid            both
`bson.dbref.DBRef`                   dbref          both
None                                 undefined      bson -> py
unicode                              code           bson -> py
`bson.code.Code`                     code           py -> bson
unicode                              symbol         bson -> py
===================================  =============  ===================

Note that to save binary data it must be wrapped as an instance of
`bson.binary.Binary`. Otherwise it will be saved as a BSON string
and retrieved as unicode.

.. [#dt] datetime.datetime instances will be rounded to the nearest
   millisecond when saved
.. [#dt2] all datetime.datetime instances are treated as *naive*. clients
   should always use UTC.

Definition at line 23 of file bson/son.py.


Member Function Documentation

def bson::son::SON::__cmp__ (   self,
  other 
)

Definition at line 179 of file bson/son.py.

def bson::son::SON::__contains__ (   self,
  key 
)

Definition at line 103 of file bson/son.py.

def bson::son::SON::__deepcopy__ (   self,
  memo 
)

Definition at line 207 of file bson/son.py.

def bson::son::SON::__delitem__ (   self,
  key 
)

Definition at line 81 of file bson/son.py.

def bson::son::SON::__init__ (   self,
  data = None,
  kwargs 
)

Definition at line 64 of file bson/son.py.

def bson::son::SON::__iter__ (   self  ) 

Definition at line 96 of file bson/son.py.

def bson::son::SON::__len__ (   self  ) 

Definition at line 185 of file bson/son.py.

def bson::son::SON::__repr__ (   self  ) 

Definition at line 70 of file bson/son.py.

def bson::son::SON::__setitem__ (   self,
  key,
  value 
)

Definition at line 76 of file bson/son.py.

def bson::son::SON::clear (   self  ) 

Definition at line 125 of file bson/son.py.

def bson::son::SON::copy (   self  ) 

Definition at line 88 of file bson/son.py.

def bson::son::SON::get (   self,
  key,
  default = None 
)

Definition at line 173 of file bson/son.py.

def bson::son::SON::has_key (   self,
  key 
)

Definition at line 100 of file bson/son.py.

def bson::son::SON::items (   self  ) 

Definition at line 122 of file bson/son.py.

def bson::son::SON::iteritems (   self  ) 

Definition at line 107 of file bson/son.py.

def bson::son::SON::iterkeys (   self  ) 

Definition at line 111 of file bson/son.py.

def bson::son::SON::itervalues (   self  ) 

Definition at line 115 of file bson/son.py.

def bson::son::SON::keys (   self  ) 

Definition at line 85 of file bson/son.py.

def bson::son::SON::pop (   self,
  key,
  args 
)

Definition at line 136 of file bson/son.py.

def bson::son::SON::popitem (   self  ) 

Definition at line 149 of file bson/son.py.

def bson::son::SON::setdefault (   self,
  key,
  default = None 
)

Definition at line 129 of file bson/son.py.

def bson::son::SON::to_dict (   self  ) 
Convert a SON document to a normal Python dictionary instance.

This is trickier than just *dict(...)* because it needs to be
recursive.

Definition at line 188 of file bson/son.py.

def bson::son::SON::update (   self,
  other = None,
  kwargs 
)

Definition at line 157 of file bson/son.py.

def bson::son::SON::values (   self  ) 

Definition at line 119 of file bson/son.py.


Member Data Documentation

Definition at line 65 of file bson/son.py.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines


pymongo
Author(s): Bhaskara Marthi
autogenerated on Fri Jan 11 10:09:05 2013