Configuring Update Document Service
An Update Document service updates the existing information in a collection and includes a mapping for an output field count that stores the number of documents affected by the update operation.
Note:
Update service internally uses MongoDB updateMany operation. Refer to MongoDB documentation for more details on updateMany.
Refer the section
Before Configuring or Managing Adapter
Services before configuring adapter services.
To configure Update service
1. In Designer, right-click the package which the service contains and select New > Adapter Service.
2. Select the parent namespace, type a name for the adapter service, and click Next .
3. Select Adapter for MongoDB as the adapter type and click Next.
4. Select the appropriate Adapter Connection Name and click Next.
5. From the list of available templates, select the Update Document template and click Finish.
The adapter service editor for the adapter service appears. You can select the Adapter Settings tab at any time to confirm adapter service properties such as the Adapter Name, Adapter Connection Name , and Adapter Service Template .
6. Use the Collection tab to configure the collections which the operation accesses.
Field | Description/Action |
Database | Displays the database name that you provide in the Connections. |
Collection | Lists the collection present in the Database. |
Sampling Limit | Specify the number of sampling documents to be scanned to get the Document Fields. |
Acknowledgment | Requests the acknowledgment that the Write operation propagates to a specified number of mongod instances. |
Journal | You select to request the acknowledgment that the mongod instances has written to the on-disk journal. |
TimeOut | A time limit to avoid the Write operations from blocking indefinitely. |
Upsert | You select to create a new document if the query is unable to retrieve any documents. |
Bypass Document Validation | You select to enable the update operation to bypass document validation. |
7. Select the Update tab to define the fields to be selected as follows:
a. Use the icon to create new rows as needed. You can use the icon to fill in all rows to the table. Field | Description/Action |
Document Fields | Name of the fields from sampling documents that you want to use. |
Field Type | Specifies the MongoDB data type for Document Fields. |
Input Field | Provide a value for query input during the design time or runtime. |
Input Field Type | Specifies the Java data type. |
Operator | Specifies the Update operator. |
8. Use Filter tab to specify the conditions using the following fields for selecting information:
a. Select the icon to define new fields. You can use the icon to fill in all rows to the table. b. Select a MongoDB Operator, and separators(left and right parenthesis), and specify values for the following fields:
Field | Description /Action |
AND/OR | The logical operator. |
Document Field | Name of the fields from sampling documents that you want to use. |
Field Type | Specifies the MongoDB data type for Document Fields. |
Input Field | Provide a value for query input during the design time or runtime. |
Input Field Type | Specifies Java data type. |
Parameter | Displays the index of the output field. |
c. You can also use or icons to change the order of the fields or documents to ensure the parameters are parsed in the correct order. d. Repeat this procedure until you have specified all the parameters.
9. From the File menu, select Save.