On this page本页内容
$pullAll¶The $pullAll operator removes all instances of the specified values from an existing array. $pullAll运算符从现有数组中删除指定值的所有实例。Unlike the 与$pull operator that removes elements by specifying a query, $pullAll removes elements that match the listed values.$pull运算符通过指定查询来删除元素不同,$pullAll会删除与列出的值匹配的元素。
The $pullAll operator has the form:$pullAll运算符的形式如下:
To specify a 若要在嵌入式文档或数组中指定一个<field> in an embedded document or in an array, use dot notation.<field>,请使用点表示法。
If a 如果要删除的<value> to remove is a document or an array, $pullAll removes only the elements in the array that match the specified <value> exactly, including order.<value>是文档或数组,$pullAll只删除数组中与指定<value>完全匹配的元素,包括顺序。
Given the following document in the 鉴于survey collection:survey集合中的以下文件:
The following operation removes all instances of the value 以下操作将从0 and 5 from the scores array:scores数组中删除值0和5的所有实例:
After the operation, the updated document has all instances of 操作完成后,更新的文档将从0 and 5 removed from the scores field:scores字段中删除0和5的所有实例:
See also参阅