Updating Multiple Objects¶
This API updates multiple objects in a data table with a single request. Consider the following example, it demonstrates an API call which updates all objects in the Person
data table where the value of the property age
is greater than 20
. As a result of the request, all updated objects will have the contactType
property set to "personal"
:
Backendless.Data.of( "Person" ).bulkUpdate( "age > 20", { "contactType":"personal" } )
.then( function( objectsUpdated ) {
console.log( "Server has updated " + objectsUpdated + " objects" );
})
.catch( function( error ) {
console.log( "Server reported an error " + error );
})
Backendless.Data.of( "TABLE-NAME" ).bulkUpdate( whereClause, changes )
.then( function( objectsUpdated ) {
})
.catch( function( error ) {
});
function DataTypeX() {
this.propertyA = "";
this.propertyB = "";
}
Backendless.Data.of( DataTypeX ).save( whereClause, changes )
.then( function( objectsUpdated ) {
})
.catch( function( error ) {
});
where:
Argument | Description |
---|---|
DataTypeX |
function/class identifying the table where the objects will be updated. |
"TABLE-NAME" |
name of the table where the objects will be updated. |
whereClause |
A string value containing the condition for selecting objects in the data table which will be updated. |
changes |
A JS object containing the changes which will be applied to all objects in the data table which match the condition expressed via whereClause . |
Return Value¶
The API does not return any values.