示例#1
0
 def pull(self, expr, *args, **kwargs):
     import expression_parser
     _data = expression_parser.to_mongobd_match(expr, *args, **kwargs)
     if self.__data__ == None:
         self.__data__ = {}
     self.__data__.update({"$pull": _data})
     return self
示例#2
0
 def __init__(self, expr, *args, **kwargs):
     import pydocs
     import expression_parser
     if isinstance(expr, pydocs.Fields):
         self.__stage__ = pydocs.get_field_expr(expr, True)
     elif type(expr) in [str, unicode]:
         self.__stage__ = expression_parser.to_mongobd_match(
             expr, *args, **kwargs)
示例#3
0
 def where(self, expr, *args, **kwargs):
     # type:()->pycollection.entity
     if type(expr) is [str, unicode]:
         return pycollection.entity(
             self,
             expression_parser.to_mongobd_match(expr, *args, **kwargs))
     elif isinstance(expr, pydocs.Fields):
         return pycollection.entity(self, pydocs.get_field_expr(expr))
     else:
         raise Exception("invalid data type {0}".format(type(expr)))