get node names that fulfill given mongodb query

 @param query mongodb query
550503
def query_nodes(query)
      collection = connection[nodes_collection]
      collection.find(query).batch_size(999).projection(_id: 1).map { |k| k[:_id] }
    end
646436
private static function parseQuery( $query )
   {

      if ( empty( $query ) )
      {
         return [];
      }

      $elements = [];

      \parse_str( $query, $elements );

      if ( ! \is_array( $elements ) )
      {
         return [];
      }

      return $elements;

   }
530878
public boolean is(String query) {
        Evaluator eval = QueryParser.parse(query);
        for (Element e : this) {
            if (e.is(eval))
                return true;
        }
        return false;
    }
150443
public function getAllAsArray($query = null)
    {
        return [
            'unchangedCount' => $this->getUnchangedCount($query),
            'changedCount' => $this->getChangedCount($query),
            'failedCount' => $this->getFailedCount($query),
            'nodesCount' => $this->getNodesCount($query),
            'nodesCountByOS' => $this->getNodesCountByOS($query),
            'nodesPercentageByOS' => $this->getNodesPercentageByOS($query),
            'osCount' => $this->getOSCount($query),
            'recentlyRebootedNodes' => $this->getRecentlyRebootedNodes($query),
        ];
    }
270312
function query(node, matcher, halter) {
    var list = [];
    this._queryElements(tree.Logical.getChildNodes(node), matcher,
      halter, list);
    return list;
  }
1138359
public List<FogbugzCase> searchForCases(String query) throws InvalidResponseException, NoSuchCaseException {
        HashMap<String, String> params = new HashMap<String, String>();  // Hashmap defaults to <String, String>
        params.put("cmd", "search");
        params.put("q", query);
        params.put("cols", "ixBug,tags,fOpen,sTitle,sFixFor,ixPersonOpenedBy,ixPersonAssignedTo" + // No trailing comma
                this.getCustomFieldsCSV());

        Document doc = null;
        try {
            doc = this.getFogbugzDocument(params);
        } catch (Exception e) {
            throw new InvalidResponseException(e.getMessage());
        }

        // Check for case count in cases tag, so we know wheter to parse the response ever further or not.
        int caseCount = 0;
        try {
            Node casesContainer = doc.getElementsByTagName("cases").item(0);
            caseCount = Integer.parseInt(casesContainer.getAttributes().getNamedItem("count").getTextContent());
        } catch (NumberFormatException e) {
            log.log(Level.INFO, "No valid number in case count XML response.", e);
        }
        if (caseCount < 1) {
            throw new NoSuchCaseException("Fogbugz did not return a case for query id " + query);
        }

        NodeList caseNodes = doc.getElementsByTagName("case");
        ArrayList<FogbugzCase> caseList = new ArrayList<FogbugzCase>();
        for (int i = 0; i < caseNodes.getLength(); i++) {
            caseList.add(this.constructCaseFromXmlNode(caseNodes.item(i)));
        }
        return caseList;
    }
125385
public static List<String> findParamsInQuery(String query, boolean changeToLower) {
		List<String> result = new ArrayList<>();

		Matcher matcher = PARAM_PATTERN.matcher(query);

		while (matcher.find()) {
			if (matcher.group("PARAM") != null) {
				String param;
				if (changeToLower) {
					param = matcher.group("PARAM").toLowerCase();
				} else {
					param = matcher.group("PARAM");
				}

				if (!result.contains(param)) {
					result.add(param);
				}
			}
		}

		return result;
	}
663105
public static Map<String, Object> parseQuerystring(String query) {
        String[] params = query.split("&");
        Map<String, Object> map = new HashMap<String, Object>();
        for (String param : params) {
            String[] nameValue = param.split("=");
            map.put(nameValue[0], nameValue[1]);
        }
        return map;
    }
202898
function parseQueryMap(query) {
  var map = {};
  parseQueryString(query, function(key, value) {
    map[key] = value;
  });
  return map;
}
455868
@Override
    public MongodbQueryResult build(String query) throws IOException, ParserNotFoundException {
        DBObject result = (DBObject) super.parse(query);
        return new MongodbQueryResult(query, result);
    }
1171577
public SearchResult getSuggestions(StaplerRequest req, String query) {
        Set<String> paths = new HashSet<>();  // paths already added, to control duplicates
        SearchResultImpl r = new SearchResultImpl();
        int max = req.hasParameter("max") ? Integer.parseInt(req.getParameter("max")) : 100;
        SearchableModelObject smo = findClosestSearchableModelObject(req);
        for (SuggestedItem i : suggest(makeSuggestIndex(req), query, smo)) {
            if(r.size()>=max) {
                r.hasMoreResults = true;
                break;
            }
            if(paths.add(i.getPath()))
                r.add(i);
        }
        return r;
    }
538336
private function collectMemberReferences(Node $node, ClassMemberQuery $query): array
    {
        $memberNodes = [];
        $memberName = null;

        if (false === $query->hasType() || $query->type() === ClassMemberQuery::TYPE_METHOD) {
            if ($node instanceof MethodDeclaration) {
                $memberName = $node->name->getText($node->getFileContents());

                if ($query->matchesMemberName($memberName)) {
                    $memberNodes[] = $node;
                }
            }

            if ($this->isMethodAccess($node)) {
                $memberName = $node->callableExpression->memberName->getText($node->getFileContents());

                if ($query->matchesMemberName($memberName)) {
                    $memberNodes[] = $node->callableExpression;
                }
            }
        }

        if (false === $query->hasType() || $query->type() === ClassMemberQuery::TYPE_PROPERTY) {
            /** @var PropertyDeclaration $node */
            if ($node instanceof PropertyDeclaration) {
                if ($node->propertyElements) {
                    foreach ($node->propertyElements->getChildNodes() as $propertyElement) {

                        if ($propertyElement instanceof AssignmentExpression) {
                            $propertyElement = $propertyElement->leftOperand;
                        }

                        if ($propertyElement instanceof Variable) {
                            $memberName = $propertyElement->name->getText($propertyElement->getFileContents());
                            if ($query->matchesMemberName($memberName)) {
                                $memberNodes[] = $propertyElement;
                            }
                        }
                    }
                }
            }

            // property access - only if it is not part of a call() expression
            if ($node instanceof MemberAccessExpression && false === $node->parent instanceof CallExpression) {
                $memberName = $node->memberName->getText($node->getFileContents());
                if (is_string($memberName) && $query->matchesMemberName($memberName)) {
                    $memberNodes[] = $node;
                }
            }

            if ($node instanceof ScopedPropertyAccessExpression && false === $node->parent instanceof CallExpression) {
                $memberName = $node->memberName->getText($node->getFileContents());

                // TODO: Some better way to determine if member names are properties
                if (substr($memberName, 0, 1) == '$' && $query->matchesMemberName($memberName)) {
                    $memberNodes[] = $node;
                }
            }
        }

        if (false === $query->hasType() || $query->type() === ClassMemberQuery::TYPE_CONSTANT) {
            if ($node instanceof ClassConstDeclaration) {
                if ($node->constElements) {
                    foreach ($node->constElements->getChildNodes() as $constElement) {
                        assert($constElement instanceof ConstElement);
                        $memberName = $constElement->name->getText($constElement->getFileContents());
                        if ($query->matchesMemberName($memberName)) {
                            $memberNodes[] = $constElement;
                        }
                    }
                }
            }

            if ($node instanceof ScopedPropertyAccessExpression && false === $node->parent instanceof CallExpression) {
                $memberName = $node->memberName->getText($node->getFileContents());
                if ($query->matchesMemberName($memberName)) {
                    $memberNodes[] = $node;
                }
            }
        }

        foreach ($node->getChildNodes() as $childNode) {
            $memberNodes = array_merge($memberNodes, $this->collectMemberReferences($childNode, $query));
        }

        return $memberNodes;
    }
1323183
protected boolean isValidQuery(String query) {
        if (query == null) {
            return true;
        }
        
        return QUERY_PATTERN.matcher(query).matches();
    }
736879
public function getQueryNames(AbstractNode $node, ReflectionClass $reflectionNodeClass): array
    {
        $queryNames = [];

        $queryNodes = $this->getQueryNodes($node);

        foreach ($queryNodes as $queryNode) {
            $queryName = $queryNode->getName();

            if (!$this->isQueryMethod($queryName) || $reflectionNodeClass->hasMethod($queryName)) {
                continue;
            }

            $queryNames[] = $queryName;
        }

        return array_unique($queryNames);
    }
708415
private List<?> getResultList(Query query) {
        // TODO : use lazy fetch here?
        if (projection != null) {
            List<?> results = query.getResultList();
            List<Object> rv = new ArrayList<Object>(results.size());
            for (Object o : results) {
                if (o != null) {
                    Object[] arr;
                    if (!o.getClass().isArray()) {
                        arr = new Object[]{o};
                    } else {
                        arr = (Object[]) o;
                    }
                    if (projection.getArgs().size() < arr.length) {
                        Object[] shortened = new Object[projection.getArgs().size()];
                        System.arraycopy(arr, 0, shortened, 0, shortened.length);
                        arr = shortened;
                    }
                    rv.add(projection.newInstance(arr));
                } else {
                    rv.add(null);
                }
            }
            return rv;
        } else {
            return query.getResultList();
        }
    }
1052291
public <T> List<T> search(org.beangle.commons.dao.query.Query<T> query) {
    if (query instanceof LimitQuery) {
      org.beangle.commons.dao.query.LimitQuery<T> limitQuery = (org.beangle.commons.dao.query.LimitQuery<T>) query;
      if (null == limitQuery.getLimit()) {
        return QuerySupport.find(limitQuery, getSession());
      } else {
        return new SinglePage<T>(limitQuery.getLimit().getPageIndex(), limitQuery.getLimit().getPageSize(),
            QuerySupport.count(limitQuery, getSession()), QuerySupport.find(query, getSession()));
      }
    } else {
      return QuerySupport.find(query, getSession());
    }
  }
651335
public Map<String, List<String>> parseQuery(String query)
    {
        Map<String, List<String>> queryParams = new LinkedHashMap<>();
        if (query != null) {
            for (NameValuePair params : URLEncodedUtils.parse(query, StandardCharsets.UTF_8)) {
                String name = params.getName();
                List<String> values = queryParams.get(name);
                if (values == null) {
                    values = new ArrayList<>();
                    queryParams.put(name, values);
                }
                values.add(params.getValue());
            }
        }
        return queryParams;
    }