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

MongoDBDelete

This system keyword is used to delete documents from 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

Condition (in BSON format) for deletion. By default, this parameter is left blank to query all data in the collection and delete the data.

JustOne

No

Boolean

Whether to delete a single data record. false: Delete all documents that meet the conditions. true (default) or not configured: Delete only one document that meets the conditions.

MongoDBDelete Response

Status: success

Parameter

Type

Description

affected_row_count

Integer

Number of rows affected by document deletion

MongoDBDelete Response Example

{
  "affected_row_count" : 1
}

MongoDBDelete Usage Example

Delete documents based on the entered query parameters. The system keyword returns the number of deleted records.

If the JustOne parameter is set to false, all matched documents are deleted.

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