On this page本页内容
Bulk.find.
arrayFilters
(<array of filter documents>)¶New in version 3.6.版本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. $[<identifier>]
筛选的位置运算符定义一个标识符,然后在数组筛选文档中引用该标识符。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.<identifier>
必须以小写字母开头,并且只包含字母数字字符。
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. $[identifier]
),必须指定一个对应的数组筛选器文档。That is, you cannot specify multiple array filter documents for the same identifier. 也就是说,不能为同一标识符指定多个数组筛选器文档。For example, if the update statement includes the identifier 例如,如果更新语句包含标识符x
(possibly multiple times), you cannot specify the following for arrayFilters
that includes 2 separate filter documents for x
:x
(可能多次),则不能为包含x
的两个单独筛选文档的arrayFilters
指定以下内容:
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 the updateOne()
and update()
operations.Bulk.find()
方法,为updateOne()
和update()
操作指定数组筛选器。