Detailed explanation of the update method of MongoDB database

In the previous article “mongodb In “Query Syntax”, I introduced the common query syntax of Mongodb. The update operation of Mongodb is also a bit complicated. I will introduce it here based on my own experience and show it to friends who use mongodb. It is also convenient to refer to when you use it later: Note: The grammar introduction in this article and the previous article are all in mongodb In the shell environment, there are some differences in usage methods when using real language programming (such as java, php, etc.), but the syntax (such as query conditions, $in, $inc, etc.) is the same. This article is introduced with reference to the official documents. The reason why there are official documents is introduced here. On the one hand, it is used as a translation. It’s hard to understand from the official documentation, I can make some supplements in actual operation. Well, without further ado, let’s start: There are two commands for mongodb update: 1).update() command db.collection.update( criteria, objNew, upsert, multi ) criteria : query criteria for update, similar to the behind where in the sql update query objNew : update object and some update operators (such as $, $inc…),…

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索