[MonogoDB] The high update operation of MongoDB, monogodbmongodb

Source: Internet
Author: User

[MonogoDB] The high update operation of MongoDB, monogodbmongodb

In the last four blog, we talked about the high query operation of mongodb. Now in this blog let's know about the high update operation about monodb.

1. Saveas for save (), whose function is to update the existing record and to create the new record.
Grammar: db. mycollection. save (x );
2. General Operation2.1 $ inc grammar: {$ inc: {field: value }}
Function: add the value to the certain field.

2.2 $ Set and $ unset {$ set: {field: value }}/ {$ unset: {field: 1 }}
Function: set the field value, if the field does not exist, then add the new field, and value will support all the types.

2.3 $ push, $ pushAll, $ addToSet {$ push: {field: value }}
Function: if the field is a existing arry, this function will add the value to the end. if filed doesnot exist, it will add the new field, and then set the field value. if field do exists but not array, it will throw error.
$ PushAll :{$ pushAll: {field: value_array }}
This function is the same as $ push, but only the value_array is array.
$ AddToSet :{$ addToSet: {field: value }}

2.4 $ pop and $ pull $ pullAll

2.5 $ rename {$ rename :{ old_friend_name: new_field_name }}

They stood on the top of the high building, _____ you cocould see the whole city

Originally, I chose A. Is it right from the top of the high building? In fact, it is not the from here. The from where comes from see from. Because there is an attribute clause, it is advanced to the beginning of the first line word, and it is now the option. The original order is:
You cocould see the whole city from the top of the high building.
Can this be explained?

When compared with the size of the whole earth, the highest mountain does not seem high at all

When the subject of a clause is the same as that of the main clause, it can be omitted. Therefore, when the clause should be complete:

When it is compared with the size of the whole earth

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.