/** * Parses an array match expression from the given json object */ public static ArrayMatchExpression fromJson(ObjectNode node) { JsonNode x = node.get("array"); if (x != null) { Path field = new Path(x.asText()); x = node.get("elemMatch"); if (x != null) { return new ArrayMatchExpression(field, QueryExpression.fromJson(x)); } } throw Error.get(QueryConstants.ERR_INVALID_ARRAY_COMPARISON_EXPRESSION, node.toString()); } }
/** * Parses an array match expression from the given json object */ public static ArrayMatchExpression fromJson(ObjectNode node) { JsonNode x = node.get("array"); if (x != null) { Path field = new Path(x.asText()); x = node.get("elemMatch"); if (x != null) { return new ArrayMatchExpression(field, QueryExpression.fromJson(x)); } } throw Error.get(QueryConstants.ERR_INVALID_ARRAY_COMPARISON_EXPRESSION, node.toString()); } }
@Override protected QueryExpression itrArrayMatchExpression(ArrayMatchExpression q, Path context) { // No need to rewrite elemMatch using relative context, because that is already interpreted relative to the array return new ArrayMatchExpression(toRelative(q.getArray(), context), q.getElemMatch()); }
@Override protected QueryExpression itrArrayMatchExpression(ArrayMatchExpression q, Path context) { // No need to rewrite elemMatch using relative context, because that is already interpreted relative to the array return new ArrayMatchExpression(toRelative(q.getArray(), context), q.getElemMatch()); }
@Override protected QueryExpression itrArrayMatchExpression(ArrayMatchExpression q, Path context) { Path p = rewrite(context, q.getArray()); if (!p.equals(q.getArray())) { return new ArrayMatchExpression(p, q.getElemMatch()); } else { return q; } }
@Override protected QueryExpression itrArrayMatchExpression(ArrayMatchExpression q, Path context) { Path p = rewrite(context, q.getArray()); if (!p.equals(q.getArray())) { return new ArrayMatchExpression(p, q.getElemMatch()); } else { return q; } }
@Override protected QueryExpression itrArrayMatchExpression(ArrayMatchExpression q, Path context) { Path p = rewrite(context, q.getArray()); if (!p.equals(q.getArray())) { return new ArrayMatchExpression(p, q.getElemMatch()); } else { return q; } }
@Override protected QueryExpression itrArrayMatchExpression(ArrayMatchExpression q, Path context) { ArrayMatchExpression x = (ArrayMatchExpression) super.itrArrayMatchExpression(q, context); Path p = map(applyContext(context, x.getArray())); if (p != null) { return new ArrayMatchExpression(removeContext(context, p, x.getArray()), x.getElemMatch()); } else { return x; } }
@Override protected QueryExpression itrArrayMatchExpression(ArrayMatchExpression q, Path context) { ArrayMatchExpression x = (ArrayMatchExpression) super.itrArrayMatchExpression(q, context); Path p = map(applyContext(context, x.getArray())); if (p != null) { return new ArrayMatchExpression(removeContext(context, p, x.getArray()), x.getElemMatch()); } else { return x; } }
LOGGER.debug("Rewritten nested query={}",newNestedq); if(newNestedq!=nestedq) newq=new ArrayMatchExpression( ((ArrayMatchExpression)q).getArray(),newNestedq);
LOGGER.debug("Rewritten nested query={}", newNestedq); if (newNestedq != nestedq) { newq = new ArrayMatchExpression(((ArrayMatchExpression) q).getArray(), newNestedq);
LOGGER.debug("Rewritten nested query={}", newNestedq); if (newNestedq != nestedq) { newq = new ArrayMatchExpression(((ArrayMatchExpression) q).getArray(), newNestedq);
/** * Default behavior is to recursively iterate the nested query. If nested * processing returns an object different from the original nested query, * this method creates a new array match expression using the new query * expression, and returns that. */ protected QueryExpression itrArrayMatchExpression(ArrayMatchExpression q, Path context) { QueryExpression newq = iterate(q.getElemMatch(), new Path(new Path(context, q.getArray()), Path.ANYPATH)); if (newq != q.getElemMatch()) { return new ArrayMatchExpression(q.getArray(), newq); } else { return q; } } }
/** * Default behavior is to recursively iterate the nested query. If nested * processing returns an object different from the original nested query, * this method creates a new array match expression using the new query * expression, and returns that. */ protected QueryExpression itrArrayMatchExpression(ArrayMatchExpression q, Path context) { QueryExpression newq = iterate(q.getElemMatch(), new Path(new Path(context, q.getArray()), Path.ANYPATH)); if (newq != q.getElemMatch()) { return new ArrayMatchExpression(q.getArray(), newq); } else { return q; } } }
return new ArrayMatchExpression(addPrefix(closestArray), em); return new ArrayMatchExpression(relative, iterate(q.getElemMatch(), newContext)); } else { QueryExpression em = iterate(q.getElemMatch(), newContext); return new ArrayMatchExpression(addPrefix(q.getArray()), em);
return new ArrayMatchExpression(addPrefix(closestArray), em); return new ArrayMatchExpression(relative, iterate(q.getElemMatch(), newContext)); } else { QueryExpression em = iterate(q.getElemMatch(), newContext); return new ArrayMatchExpression(addPrefix(q.getArray()), em);