How to use MongoDBUpdate
I recently started reading some articles about MongoDB, and I feel more and more that it is what I need. However, I don’t know much about it first, and what I see are superficial phenomena, let’s get to know it slowly. I started reading the introduction to MongoDB written by Carl yesterday. It has 33 pages in total. I feel that the article is not very clear, and I need to try and experience it myself. For traditional databases, CRUD (=Create+Read+Update+Delete) is the core, and U is the most worthy of attention! Today, I read the introduction of the Update part and practiced it. Update has 4 parameters: the first, selector, the second, newValue, the third, upserts, the fourth, multipleUpdate The selector is the same as the CRD, it is a search selector that specifies the query conditions; newValue is the content to be updated, including two basic situations, that is, whether there are parameters such as $set, $inc, and $push: Case 1, if there is no parameter, then newValue replaces the content of the original selector; Case 2, if there are parameters, then $set is to update newValue for the specified field; $inc requires the specified field to be…