Skip to main content

Buffer Update Destination Step - Designer Web

Update the values in a buffer.

Praise Magidi avatar
Written by Praise Magidi
Updated over a week ago

A buffer is used to store data in the Synatic platform. The Buffer Update Destination step is used to update the values in a buffer using the MongoDB structure. It can be used for operations such as Update One, Update Many and Replace to manipulate records.

To use it, define the update logic in a calculator step by setting a $update object, which is then passed to the Buffer Update step to operate.

Illustrated below is a flow where the Buffer Update Destination Step is used for the Update operation.

A screenshot of a computer

AI-generated content may be incorrect.


Adding a Buffer Update Destination Step

To add a Buffer Update Destination Step in a flow, follow the instructions below:

1. Click on the highlighted icon as shown in the image below.

2. The page below will appear. Select or search for a Destination step. Click on the Destination tab and select Buffer Update as shown in the image below.

A screenshot of a computer

AI-generated content may be incorrect.

Configuring the Buffer Update Destination Step

Illustrated in the image below is the configuration that is available in the Buffer Update Destination Step.

A screenshot of a computer

AI-generated content may be incorrect.

Buffer ID

The target Buffer to store the data in. Click the highlighted plus (+) icon to create a new Buffer or click the outlined arrow to select a pre-created Buffer from the dropdown list.

Operation

The operations to perform on the Buffer. The options available are Update One, Update Many, and Replace.

Update One Operation

Select the Update One option from the Operation selection list.

A screen shot of a computer

AI-generated content may be incorrect.

Updates a single record where the field specified in the Buffer Update step config matches a record in the buffer. In the Calculator step, use the following syntax:

A screenshot of a computer

AI-generated content may be incorrect.

To update or create fields:

inputRecord.$update = { $set: { FieldName: "SynaticTest" } };

To remove fields:

inputRecord.$update = { $unset: { FieldName: "" } };
  • $set is for create/update

  • $unset is for delete


Update Many Operation

Select the Update Many option from the Operation selection list.

A screen shot of a computer

AI-generated content may be incorrect.

Works the same way as Update One, but applies the update to all matching records in the buffer data based on what you set in the Buffer Update config.

To update or create fields:

inputRecord.$update = { $set: { FieldName: "SynaticTest" } };

To remove fields:

inputRecord.$update = { $unset: { FieldName: "" } };
  • $set is for create/update

  • $unset is for delete


Replace Operation

Select the Replace option from the Operation selection list.

A screen shot of a computer

AI-generated content may be incorrect.

Replaces the entire record where the field in the Buffer Update step matches a record in the buffer. In a calculator, use the following syntax:

return { $update: inputRecord, _id: inputRecord._id };
A screenshot of a computer

AI-generated content may be incorrect.

The _id after the comma is so we can get the _id back on the inputRecord object for the buffer update step, since the above would set the _id on the $update object.


Filter

This option uses the Query builder to identify multiple key fields to update.

Upsert checkbox

Select this option to create the record if it does not meet the criteria.

Did this answer your question?