Update Documents
Description
MongoDB: Update Documents plugin step updates documents with provided field name and field values on specified MongoDB instance.
Limitation: The step supports only the following data types through table fields: String, Int32, Int64, ObjectId, Double, Boolean, Date, Null, and Decimal128
Note:
- Field Datatype is Null and Field Value is not given by default it will take the value as “null”.
- Field Datatype is String and Field Value is not given by default it will take the value as “”(empty string).
Configurations
No. | Field Name | Description |
---|---|---|
Connection | ||
2 | Deployment Type | Deployment Type differentiates between on cloud or on premise instances. Select the type of deployment you require. Available values: On-Cloud or On-Premise. The data type is String. This field is mandatory. |
3 | Host Name | Specify the host name based on the type of deployment you selected. Therefore, if deployment type is On-Cloud specify the cluster name and for On-Premise specify the IP address of the machine. The data type is String. This field is mandatory. |
4 | Port | Specify the port number of the MongoDB instance. The default value is 27017. Note: Port number is mandatory for Deployment Type: On-Premise. |
5 | Username | Specify a username to access the database. The data type is String. This field is mandatory. |
Password | ||
6 | Accept Values from fields | Leave checkbox unchecked to accept Password value from a field in the previous steps of the stream using a drop down list. Else enable checkbox for Password field to appear as Text box. |
7 | Password | Specify the password for the username. If checkbox above is enabled Password field appears as Text box and accepts static values or variables. Else if checkbox above is disabled Password field appears as a drop down to select fields from previous steps. The data type is String. This field is mandatory. |
8 | Button: Test Connection | Verifies whether the connection is available or not. For the purpose of verification fields coming from previous steps are not allowed. Static values and environment variables are allowed. |
Database and Collection Tab: | ||
1 | Database Name | Specify database name where you want to update a document. A database stores one or more collections of documents. The data type is String. This field is mandatory. |
2 | Get | On click of this button, if connection is successfully established, it populates a list of database names on MongoDB Server. |
3 | Collection Name | Specify the collection name where you want to udpate a document. |
4 | Get | On click of this button, if connection is successfully established, it populate a list of collections for the specified database. |
5 | Criteria Query | Specify a combination of static values or variables and the previous step. The Criteria Query expression uses MongoDB’s JSON-like query language with query operators to perform query operations. Note: Query must be same as MongoDB Compass. |
Connect To Update Tab: | ||
1 | Accept fields as JSON | Leave checkbox unchecked to accept JSON value from a field in the previous steps of the stream using a drop down list. Else enable checkbox for JSON field to appear as a Text box. |
2 | JSON | Select a field name from the drop-down list or provide a variable; containing the JSON text. Provide JSON in a valid format with field records to update. The field data type is String. Sample JSON: {"name":"Ross","status":"2"} |
Table Fields: | Provide a JSON with records to update or else select fields and values to update in the tabular columns below. | |
3 | Field Name | Double click to populate, fields associated with the form name. The data type is string. This field is mandatory. |
4 | Field Value | Specify valid values for the field associated with the field name. The data type is string. |
5 | Field Datatype | Specify a valid datatype from the provided list of field name and field value. Available data types: String, Int32, Int64, ObjectID, Double, Boolean, Null, Decimal128, and Date. |
Sample JSON with Examples:
Sample Syntax:
{"field1":integerValue1,"field2":"stringValue2","field3":doubleValue3,"field4":booleanValue4,"field5":"dateValue5","field6":"nullValue6","field7":"hexaDecimalValue6"}"
Example1:
{"MobileNumber":951234567,"FirstName":"abc","salary":3000.45,"status":true,"AddedON":"2022-04-28","AddedON":"2021-06-23T08:30:00.000+00:00","MiddleName":NULL, "ID":50d57312f08da4e79144bafb}";
Example2:
{ "item": "journal", "qty": 25, "size": { "h": 14, "w": 21, "uom": "cm" }, "status": "A" }