nodes: 0, module; 1, function_definition; 2, function_name:query; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, dictionary_splat_pattern; 10, expression_statement; 11, if_statement; 12, expression_statement; 13, if_statement; 14, expression_statement; 15, if_statement; 16, identifier:properties; 17, None; 18, identifier:criteria; 19, None; 20, identifier:distinct_key; 21, None; 22, identifier:kwargs; 23, comment:"""
          Convenience method for database access.  All properties and criteria
          can be specified using simplified names defined in Aliases.  You can
          use the supported_properties property to get the list of supported
          properties.
  
          Results are returned as an iterator of dicts to ensure memory and cpu
          efficiency.
  
          Note that the dict returned have keys also in the simplified names
          form, not in the mongo format. For example, if you query for
          "analysis.e_above_hull", the returned result must be accessed as
          r['analysis.e_above_hull'] instead of mongo's
          r['analysis']['e_above_hull']. This is a *feature* of the query engine
          to allow simple access to deeply nested docs without having to resort
          to some recursion to go deep into the result.
  
          However, if you query for 'analysis', the entire 'analysis' key is
          returned as r['analysis'] and then the subkeys can be accessed in the
          usual form, i.e., r['analysis']['e_above_hull']
  
          :param properties: Properties to query for. Defaults to None which means all supported properties.
          :param criteria: Criteria to query for as a dict.
          :param distinct_key: If not None, the key for which to get distinct results
          :param \*\*kwargs: Other kwargs supported by pymongo.collection.find.
              Useful examples are limit, skip, sort, etc.
          :return: A QueryResults Iterable, which is somewhat like pymongo's
              cursor except that it performs mapping. In general, the dev does
              not need to concern himself with the form. It is sufficient to know
              that the results are in the form of an iterable of dicts.
          """; 24, comparison_operator:properties is not None; 25, block; 26, else_clause; 27, assignment; 28, attribute; 29, block; 30, assignment; 31, comparison_operator:distinct_key is not None; 32, block; 33, else_clause; 34, identifier:properties; 35, None; 36, expression_statement; 37, block; 38, identifier:crit; 39, call; 40, identifier:self; 41, identifier:query_post; 42, for_statement; 43, identifier:cur; 44, call; 45, identifier:distinct_key; 46, None; 47, expression_statement; 48, return_statement; 49, block; 50, assignment; 51, expression_statement; 52, attribute; 53, argument_list; 54, identifier:func; 55, attribute; 56, block; 57, attribute; 58, argument_list; 59, assignment; 60, call; 61, return_statement; 62, pattern_list; 63, call; 64, assignment; 65, identifier:self; 66, identifier:_parse_criteria; 67, identifier:criteria; 68, identifier:self; 69, identifier:query_post; 70, expression_statement; 71, attribute; 72, identifier:find; 73, keyword_argument; 74, keyword_argument; 75, dictionary_splat; 76, identifier:cur; 77, call; 78, identifier:QueryListResults; 79, argument_list; 80, call; 81, identifier:props; 82, identifier:prop_dict; 83, attribute; 84, argument_list; 85, pattern_list; 86, expression_list; 87, call; 88, identifier:self; 89, identifier:collection; 90, identifier:filter; 91, identifier:crit; 92, identifier:projection; 93, identifier:props; 94, identifier:kwargs; 95, attribute; 96, argument_list; 97, identifier:prop_dict; 98, identifier:cur; 99, keyword_argument; 100, identifier:QueryResults; 101, argument_list; 102, identifier:self; 103, identifier:_parse_properties; 104, identifier:properties; 105, identifier:props; 106, identifier:prop_dict; 107, None; 108, None; 109, identifier:func; 110, argument_list; 111, identifier:cur; 112, identifier:distinct; 113, identifier:distinct_key; 114, identifier:postprocess; 115, attribute; 116, identifier:prop_dict; 117, identifier:cur; 118, keyword_argument; 119, identifier:crit; 120, identifier:props; 121, identifier:self; 122, identifier:result_post; 123, identifier:postprocess; 124, attribute; 125, identifier:self; 126, identifier:result_post
code: def query(self, properties=None, criteria=None, distinct_key=None,
                **kwargs):
          """
          Convenience method for database access.  All properties and criteria
          can be specified using simplified names defined in Aliases.  You can
          use the supported_properties property to get the list of supported
          properties.
  
          Results are returned as an iterator of dicts to ensure memory and cpu
          efficiency.
  
          Note that the dict returned have keys also in the simplified names
          form, not in the mongo format. For example, if you query for
          "analysis.e_above_hull", the returned result must be accessed as
          r['analysis.e_above_hull'] instead of mongo's
          r['analysis']['e_above_hull']. This is a *feature* of the query engine
          to allow simple access to deeply nested docs without having to resort
          to some recursion to go deep into the result.
  
          However, if you query for 'analysis', the entire 'analysis' key is
          returned as r['analysis'] and then the subkeys can be accessed in the
          usual form, i.e., r['analysis']['e_above_hull']
  
          :param properties: Properties to query for. Defaults to None which means all supported properties.
          :param criteria: Criteria to query for as a dict.
          :param distinct_key: If not None, the key for which to get distinct results
          :param \*\*kwargs: Other kwargs supported by pymongo.collection.find.
              Useful examples are limit, skip, sort, etc.
          :return: A QueryResults Iterable, which is somewhat like pymongo's
              cursor except that it performs mapping. In general, the dev does
              not need to concern himself with the form. It is sufficient to know
              that the results are in the form of an iterable of dicts.
          """
          if properties is not None:
              props, prop_dict = self._parse_properties(properties)
          else:
              props, prop_dict = None, None
  
          crit = self._parse_criteria(criteria)
          if self.query_post:
              for func in self.query_post:
                  func(crit, props)
          cur = self.collection.find(filter=crit, projection=props, **kwargs)
  
          if distinct_key is not None:
              cur = cur.distinct(distinct_key)
              return QueryListResults(prop_dict, cur, postprocess=self.result_post)
          else:
              return QueryResults(prop_dict, cur, postprocess=self.result_post)