Adds a match stage at the query
        :param query_dict: The params as dict
        :param query: The parameters of the query
        :return: The current object
431226
def match(self, query_dict=None, **query):
        
        if query_dict:
            self._q.append({'$match': query_dict})
        else:
            self._q.append({'$match': query})
        return self
1190851
def query(self, query, **kwargs):
        
        params = {'q': query}
        response = requests.get(self._get_norm_query_url(),
                                headers=self._get_rest_headers(),
                                params=params,
                                **kwargs)
        if response.status_code != requests.codes.ok:
            raise Exception(response.content)

        return response.json()
1132955
def query(self, *q):
    
    params = join_params(self.parameters, {"q": q})

    return self.__class__(**params)
186937
def _get_query_result(query, raw_result, **kwargs):
        
        if raw_result:
            return query(**kwargs)
        if kwargs:
            return QueryResult(query, **kwargs)

        return query.result
1143193
def Query(self, query):
    
    cursor = self._database.cursor()
    cursor.execute(query)
    return cursor
1344916
def make_query(self, *args, **kwargs):
        
        query = Q()  # initial is an empty query
        query_dict = self._build_query_dict(self.cleaned_data)
        if 'negate' in self.cleaned_data and self.cleaned_data['negate']:
            query = query & ~Q(**query_dict)
        else:
            query = query & Q(**query_dict)
        return query
217464
def search(self, query):
        

        return self.client.request(
            self.path + "?" + urlencode([("query", query)]),
        )
1315863
def query(self, query):
        
        if query is None:
            raise ValueError("Invalid value for `query`, must not be `None`")
        if query is not None and len(query) > 1000:
            raise ValueError("Invalid value for `query`, length must be less than or equal to `1000`")

        self._query = query
1362589
def filter(self, *query_filter):
        '''
        '''
        for query in query_filter:
            self.query.append(query)
        return self
239034
def paginate_query(self, query):
        

        if self.paginator is None:
            return None

        return self.paginator.paginate_query(query, self.request)
84123
def _canonicalize_query(self, query):

        

        def transform_query(q):

            if isinstance(q, dict):
                nq = {}
                for key,value in q.items():
                    nq[key] = transform_query(value)
                return nq
            elif isinstance(q, (list,QuerySet,tuple)):
                return [transform_query(x) for x in q]
            elif isinstance(q,Document):
                collection = self.get_collection_for_obj(q)
                ref = "%s:%s" % (collection,q.pk)
                return ref
            else:
                return q

        return transform_query(query)
679260
def initWithComplexQuery(query):
        
        q = QueryEvents()
        # provided an instance of ComplexEventQuery
        if isinstance(query, ComplexEventQuery):
            q._setVal("query", json.dumps(query.getQuery()))
        # provided query as a string containing the json object
        elif isinstance(query, six.string_types):
            foo = json.loads(query)
            q._setVal("query", query)
        # provided query as a python dict
        elif isinstance(query, dict):
            q._setVal("query", json.dumps(query))
        # unrecognized value provided
        else:
            assert False, "The instance of query parameter was not a ComplexEventQuery, a string or a python dict"
        return q
263487
def where(self, key, operator, value):
        
        self.__store_query({"key": key, "operator": operator, "value": value})
        return self
183881
def queryjoin(argdict=dict(), **kwargs):
    
    if kwargs: argdict.update(kwargs)
    
    if issubclass(type(argdict), dict):                    
        args = ["{}={}".format(k, v) for k, v in argdict.items() if v != None]
    return "&".join(args)
481509
def query(self, query, stacked=False):
        
        from jx_base.query import QueryOp

        query = QueryOp.wrap(query)

        sql, post = self._subquery(query, isolate=False, stacked=stacked)
        query.data = post(sql)
        return query.data
360316
def query_all(self):
        
        if DJANGO_20_PLUS:
            obj = self._clone()
        else:
            obj = self._clone(klass=SalesforceQuerySet)  # pylint: disable=unexpected-keyword-arg
        obj.query.set_query_all()
        return obj
873228
def query_bypass(self, query, raw_output=True):
        ''' 
        '''
        if not isinstance(query, dict):
            raise BadQueryException('Query must be dict.')

        self.__query = query
        if raw_output:
            self._raw_output = True
            return self.__get_query_result().cursor
        else:
            return self