Filter Conditions (Reference)
A filter condition can be used either on its own, as a filter specification, or at a lower level, in the query clause of a composite filter specification.
A filter condition is a JSON object whose members form one or more of these clauses:
-
scalar-equality clause
-
field-condition clause
-
logical combining clause
-
nested-condition clause
-
ID clause
-
text-contains clause
-
special-criterion clause
A filter condition is true if and only if all of its clauses are true. A filter condition can be empty (the empty object, {}), in which case all of its (zero) clauses are vacuously true (the filter condition is satisfied).
For example, if a filter involves only one filter condition and it is empty then all documents of the collection are selected. In this case, a find operation returns all of the documents, and a remove operation removes them all.
-
Scalar-Equality Clause (Reference)
A scalar-equality clause tests whether a given object field is equal to a given scalar value.
-
Field-Condition Clause (Reference)
A field-condition clause specifies that a given object field must satisfy a given set of criteria. It constrains a field using one or more condition-operator clauses, each of which is a comparison clause, a not clause, or an item-method clause.
-
Logical Combining Clause (Reference)
A logical combining clause combines the effects of multiple non-empty filter conditions.
-
Nested-Condition Clause (Reference)
You use a nested-condition clause to apply multiple conditions at the same time, to array elements that are objects.
-
Other filter operators generally look for particular JSON fields within the content of documents and try to match their values. An ID clause, which uses operator
$id, instead matches document keys. It thus matches document metadata, not document content. -
Text-Contains Clause (Reference)
A text-contains clause is operator
$textContainswith a string value that is used as a full-text search pattern:$textcontains:pattern. It matches a non-JSON document only if some text in the document matches that pattern. Matching is Oracle Text full-text matching. -
Special-Criterion Clause (Reference)
A special criterion clause is a spatial clause (with operator
$near,$intersects, or$within), or a contains clause (with operator$contains).