- Reference >
mongo
Shell Methods >- Bulk Operation Methods >
- Bulk.find.arrayFilters()
Bulk.find.arrayFilters()¶
On this page
Description¶
-
Bulk.find.
arrayFilters
(<array of filter documents>)¶ New in version 3.6.
Determines which array elements to modify for an update operation on an array field:
In the update document, use the
$[<identifier>]
filtered positional operator to define an identifier, which you then reference in the array filter documents. You cannot have an array filter document for an identifier if the identifier is not included in the update document.Note
The
<identifier>
must begin with a lowercase letter and contain only alphanumeric characters.You can include the same identifier multiple times in the update document; however, for each distinct identifier (
$[identifier]
) in the update document, you must specify exactly one corresponding array filter document. That is, you cannot specify multiple array filter documents for the same identifier. For example, if the update statement includes the identifierx
(possibly multiple times), you cannot specify the following forarrayFilters
that includes 2 separate filter documents forx
:However, you can specify compound conditions on the same identifier in a single filter document, such as in the following examples:
Append to
Bulk.find()
method to specify the array filters for theupdateOne()
andupdate()
operations.