MongoCollectionUpdateMany[MongoCollection[…],filter,update]
updates one or more documents that match the filter filter with the modification defined by update.
MongoCollectionUpdateMany
MongoCollectionUpdateMany[MongoCollection[…],filter,update]
updates one or more documents that match the filter filter with the modification defined by update.
更多信息和选项
- To use MongoCollectionUpdateMany, you first need to load MongoLink using Needs["MongoLink`"].
- filter is an Association. The the same query syntax is used as in MongoCollectionFind. The list of available query selectors can be found in the MongoDB documentation.
- update is an Association. Each key must be an update operator. The list of available update operators can be found in the MongoDB documentation.
- The following options are supported:
-
"Upsert" False whether to perform an insert if no document matches the filter. "WriteConcern" Automatic the write concern to use. - "WriteConcern" can either be Automatic, or a MongoWriteConcern object.
- More information about the behaviour of "Upsert" can be found in the MongoDB documentation.
- MongoCollectionUpdateMany corresponds to db.Collection.updateMany.
范例
基本范例 (1)
Needs["MongoLink`"]client = MongoConnect[]Connect to a the "WolframTestCollection" collection in the "WolframTestDB" database:
coll = client["WolframTestDB"]["WolframTestCollection"]Update the "age" field of every document whose "age" is 4 with an age of 13:
MongoCollectionUpdateMany[coll, <|"age" -> 4|>, <|"$set" -> <|"age" -> 13|>|>]技术笔记
相关指南
文本
Wolfram Research (2018),MongoCollectionUpdateMany,Wolfram 语言函数,https://reference.wolfram.com/language/MongoLink/ref/MongoCollectionUpdateMany.html.
CMS
Wolfram 语言. 2018. "MongoCollectionUpdateMany." Wolfram 语言与系统参考资料中心. Wolfram Research. https://reference.wolfram.com/language/MongoLink/ref/MongoCollectionUpdateMany.html.
APA
Wolfram 语言. (2018). MongoCollectionUpdateMany. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/MongoLink/ref/MongoCollectionUpdateMany.html 年
BibTeX
@misc{reference.wolfram_2026_mongocollectionupdatemany, author="Wolfram Research", title="{MongoCollectionUpdateMany}", year="2018", howpublished="\url{https://reference.wolfram.com/language/MongoLink/ref/MongoCollectionUpdateMany.html}", note=[Accessed: 12-August-2026]}
BibLaTeX
@online{reference.wolfram_2026_mongocollectionupdatemany, organization={Wolfram Research}, title={MongoCollectionUpdateMany}, year={2018}, url={https://reference.wolfram.com/language/MongoLink/ref/MongoCollectionUpdateMany.html}, note=[Accessed: 12-August-2026]}