Skip to content

Upsert Multiple Objects

Description

This operation creates and/or updates multiple objects in the database. The operation receives a collection of objects as the argument. For every object in the collection it checks if an object already exists in the database and in that case updates it with the property values in the object. Otherwise, the object is saved in the database. To check if an object exists in the database, Backendless uses the value of the objectId property.

Method

where:

Argument                Description
`` Required parameter. objects to upsert.

Return Value

An array of the objectId values of updated or inserted objects.

Example

The example below upserts two objects in the "Person" data table.

Codeless Reference

data_api_bulk_upsert_1

where:

Argument                Description
table name Name of the data table where the operation inserts and/or updates objects.
objects A list of objects to update or create.
return upserted objectIds When this box is checked, the operation returns a list of objectId values of updated or inserted objects.

Returns a list containing objectId values of updated or inserted objects.

Consider the following records in the Person data table:

data_api_bulk_upsert_2

The example below updates two objects in the Person data table:

data_api_bulk_upsert_3

The output will look as shown below after the Codeless logic runs. Values in the "age" and "email" columns were modified.

data_api_bulk_upsert_4

The operation returns the array of objectId values:

data_api_bulk_upsert_5