Updating multiple values

Here is a simple update: And, of course remember to commit.

But, the syntax example above might not show the whole truth, since we can have a situation like this: In the expanded version of our UPDATE syntax above, the value that we want to update column1 with, actually comes from a different table.

Only the '_id' field must not be specified since it's an internal field maintained by Mongo DB.

As a result of the update command you should see the following output indicating that one document has been updated.

To update multiple fields of a document the command looks like this: db.customers.update( , ); For numeric field values it is possible to modify the value regarding their old value.

The Mongo DB $inc operator is intended to be used to fulfil this purpose.

Leave a Reply

Your email address will not be published. Required fields are marked *

One thought on “updating multiple values”