3 MongoDB update
2021/11/4 2:10:04
本文主要是介绍3 MongoDB update,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
更新又三个方法:- db.collection.updateOne(<filter>, <update>, <options>)
- db.collection.updateMany(<filter>, <update>, <options>)
- db.collection.replaceOne(<filter>, <update>, <options>)
db.collection.updateOne() | 即使多个文档可能匹配指定的筛选器,但最多只更新一个匹配指定筛选器的文档。 |
db.collection.updateMany() | 更新与指定筛选器匹配的所有文档。 |
db.collection.replaceOne() | 即使多个文档可能匹配指定的筛选器,但最多只替换匹配指定筛选器的单个文档。 |
db.collection.update() | 更新或替换与指定筛选器匹配的单个文档,或更新与指定筛选器匹配的所有文档。默认情况下,db.collection.update()方法更新单个文档。要更新多个文档,请使用multi选项。 |
- db.collection.findOneAndReplace().
- db.collection.findOneAndUpdate().
- db.collection.findAndModify().
- db.collection.save().
- db.collection.bulkWrite().
这篇关于3 MongoDB update的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-06-26解决google chrome helper 内存占用较高!
- 2024-04-01got an unexpected keyword argument
- 2024-03-30维多利亚的秘密 golang入坑系统
- 2024-03-29mongodb sort by date
- 2024-03-29go swagger
- 2024-03-25mongodb cdc
- 2024-03-25how to use go in vscode
- 2024-03-22mongooseserverselectionerror: connect econnrefused ::1:27017
- 2024-03-21pymongo insert_many
- 2024-03-18projection mongodb