Skip to content

Deleting Multiple Objects

This API deletes multiple objects in a data table with a single request. Consider the following example, it demonstrates an API call which deletes all objects in the Person data table where the value of the age property is greater than 20:

Backendless.Data.of( "Person" ).bulkDelete( "age > 20" )
  .then( function( objectsDeleted ) {
    console.log( "Server has deleted " + objectsDeleted + " objects" );
  })
  .catch( function( error ) {
    console.log( "Server reported an error " + error );
  })

Blocking API

Backendless.Data.of( "TABLE-NAME" ).bulkDeleteSync( whereClase );
function DataTypeX() {
  this.propertyA = "";
  this.propertyB = "";
}
Backendless.Data.of( DataTypeX ).bulkDeleteSync( whereClause );

Non-blocking API

Backendless.Data.of( "TABLE-NAME" ).bulkDelete( whereClause )
 .then( function( objectsDeleted ) {
  })
 .catch( function( error ) {
  });
function DataTypeX() {
  this.propertyA = "";
  this.propertyB = "";
}
Backendless.Data.of( DataTypeX ).bulkDelete( whereClause )
 .then( function( objectsDeleted ) {
  })
 .catch( function( error ) {
  });

where:

Argument                Description
DataTypeX function/class identifying the table where the objects will be deleted.
"TABLE-NAME" name of the table where the objects will be deleted.
whereClause A string value containing the condition for selecting objects to be deleted in the data table.

Return Value

The API returns the number of deleted objects.