@Override protected QueryExpression itrArrayMatchExpression(ArrayMatchExpression q, Path context) { fieldInfo.add(resolveField(q.getArray(), context, q, false)); return super.itrArrayMatchExpression(q, context); }
@Override protected QueryExpression itrArrayMatchExpression(ArrayMatchExpression q, Path context) { fieldInfo.add(resolveField(q.getArray(), context, q, false)); return super.itrArrayMatchExpression(q, context); }
private DBObject translateArrayElemMatch(FieldTreeNode context, ArrayMatchExpression expr) { FieldTreeNode arrayNode = resolve(context, expr.getArray()); if (arrayNode instanceof ArrayField) { ArrayElement el = ((ArrayField) arrayNode).getElement(); if (el instanceof ObjectArrayElement) { return new BasicDBObject(translatePath(expr.getArray()), new BasicDBObject("$elemMatch", translate(el, expr.getElemMatch()))); } } throw Error.get(ERR_INVALID_FIELD, expr.toString()); }
private static boolean isFieldQueried(Path field, ArrayMatchExpression q, Path context) { LOGGER.debug("Checking if field {} is queried by array expression {}", field, q); if (isFieldQueried(field, q.getArray(), context)) { return true; } else { return q.getElemMatch().isRequired(field, new Path(new Path(context, q.getArray()), Path.ANYPATH)); } } }
@Override protected T itrArrayMatchExpression(ArrayMatchExpression q, Path context) { QueryFieldInfo oldArray=enclosingArray; enclosingArray=findFieldInfo(q.getArray(),q); T ret=processArrayMatchExpression(q.getElemMatch(), new Path(new Path(context, q.getArray()), Path.ANYPATH)); enclosingArray=oldArray; return ret; } }
private static boolean isFieldQueried(Path field, ArrayMatchExpression q, Path context) { LOGGER.debug("Checking if field {} is queried by array expression {}", field, q); if (isFieldQueried(field, q.getArray(), context)) { return true; } else { return q.getElemMatch().isRequired(field, new Path(new Path(context, q.getArray()), Path.ANYPATH)); } } }
@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; } }
@Override protected T itrArrayMatchExpression(ArrayMatchExpression q, Path context) { QueryFieldInfo oldArray=enclosingArray; enclosingArray=findFieldInfo(q.getArray(),q); T ret=processArrayMatchExpression(q.getElemMatch(), new Path(new Path(context, q.getArray()), Path.ANYPATH)); enclosingArray=oldArray; return ret; } }
@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()); }
/** * 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; } } }
private Path normalize(ArrayMatchExpression ae, Path field) { Path p = new Path(new Path(ae.getArray(), Path.ANYPATH), field); return p.normalize(); } }
private Path normalize(ArrayMatchExpression ae, Path field) { Path p = new Path(new Path(ae.getArray(), Path.ANYPATH), field); return p.normalize(); } }
public ArrayMatchEvaluator(ArrayMatchExpression expr, FieldTreeNode context) { // field needs to be resolved relative to the current context field = expr.getArray(); FieldTreeNode node = context.resolve(field); if (node == null) { throw new EvaluationError(expr); } if (node instanceof ArrayField) { elem = ((ArrayField) node).getElement(); ev = QueryEvaluator.getInstance(expr.getElemMatch(), elem); } else { throw new EvaluationError(expr, CrudConstants.ERR_EXPECTED_ARRAY + field); } }
public ArrayMatchEvaluator(ArrayMatchExpression expr, FieldTreeNode context) { // field needs to be resolved relative to the current context field = expr.getArray(); FieldTreeNode node = context.resolve(field); if (node == null) { throw new EvaluationError(expr); } if (node instanceof ArrayField) { elem = ((ArrayField) node).getElement(); ev = QueryEvaluator.getInstance(expr.getElemMatch(), elem); } else { throw new EvaluationError(expr, CrudConstants.ERR_EXPECTED_ARRAY + field); } }