elemMatch

fun elemMatch(path: PathRef, operand: Predicate): Predicate

One element at path satisfies operand, whose paths are relative to the element.

elemMatch(path("$.items[*]"), and(path("$.sku") eq "A", path("$.qty") eq 5))

The correlated question, and a different one from and over the same two leaves — that matches a document whose sku came from one element and qty from another. See Predicate.ElemMatch, and note that $.sku inside means the element's sku rather than the document's.


fun elemMatch(expression: String, operand: Predicate): Predicate

The same, from an expression: elemMatch("$.items[*]", …).