#NEWLINE# def filter( self , cls_or_collection , query , raw = False , only = None ) : #NEWLINE# #INDENT# '\n        Filter objects from the database that correspond to a given set of properties.\n\n        See :py:meth:`blitzdb.backends.base.Backend.filter` for documentation of individual parameters\n\n        .. note::\n\n            This function supports most query operators that are available in MongoDB and returns \n            a query set that is based on a MongoDB cursor.\n\n        ' #NEWLINE# if ( not isinstance ( cls_or_collection , six . string_types ) ) : #NEWLINE# #INDENT# collection = self . get_collection_for_cls ( cls_or_collection ) #NEWLINE# cls = cls_or_collection #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# collection = cls_or_collection #NEWLINE# cls = self . get_cls_for_collection ( canonical_query ) #NEWLINE# #UNINDENT# canonical_query = self . _canonicalize_query ( query ) #NEWLINE# args = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# if only : #NEWLINE# #INDENT# if isinstance ( only , tuple ) : #NEWLINE# #INDENT# args [ 'projection' ] = list ( only ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# args [ 'projection' ] = only #NEWLINE# #UNINDENT# #UNINDENT# return QuerySet ( self , cls , self . db [ collection ] . find ( canonical_query , ** args ) , raw = raw , only = only )