docs: def elem_match(self, value):
          ''' This method does two things depending on the context:
  
              1. In the context of a query expression it:
  
              Creates a query expression to do an $elemMatch on the selected
              field.  If the type of this field is a DocumentField the value
              can be either a QueryExpression using that Document's fields OR
              you can use a dict for raw mongo.
  
              See the mongo documentation for thorough treatment of
              elemMatch:
              http://docs.mongodb.org/manual/reference/operator/elemMatch/
  
              2. In the context of choosing fields in a query.fields() expr:
  
              Sets the field to use elemMatch, so only the matching elements
              of a list are used. See the mongo docs for more details:
              http://docs.mongodb.org/manual/reference/projection/elemMatch/
          '''
          self.__is_elem_match = True
          if not self.__type.is_sequence_field:
              raise BadQueryException('elem_match called on a non-sequence '
                                      'field: ' + str(self))
          if isinstance(value, dict):
              self.__fields_expr = { '$elemMatch' : value}
              return ElemMatchQueryExpression(self, {self : self.__fields_expr })
          elif isinstance(value, QueryExpression):
              self.__fields_expr = { '$elemMatch' : value.obj }
              e = ElemMatchQueryExpression(self, {
                         self : self.__fields_expr
                  })
              return e
          raise BadQueryException('elem_match requires a QueryExpression '
                                  '(to be typesafe) or a dict (which is '
                                  'not type safe)')