Updated on 2024-10-11 GMT+08:00

MongoDBUpdate

This system keyword is used to update documents in a collection based on input parameters.

Parameter

Mandatory

Type

Description

Ip

Yes

String

Database IP address

Port

Yes

Integer

Database port

User Name

Yes

String

Username

Password

Yes

String

Password (The login password is personal information and must be defined as sensitive in the environment parameters.)

DB Name

Yes

String

Database instance name

Collection

Yes

String

Collection name

Query

Yes

String

Updated query conditions (in BSON format)

Update

Yes

String

Document data to be updated (in BSON format)

Multi

No

Boolean

Whether to update all records. false (default): Update only the first record that meets the conditions. true: Update all records that meet the conditions.

MongoDBUpdate Response

Status: success

Parameter

Type

Description

affected_row_count

Integer

Number of rows affected by document update

MongoDBUpdate Response Example

{
  "affected_row_count" : 1
}

MongoDBUpdate Usage Example

Update documents in the collection based on the entered query data and update data. The system keyword returns the number of updated records.

Update all matched documents when the multi parameter is set to true.

Check whether the result is successful and whether the number of updated records is expected.