Skip to content

Spatial Data Delete API

There are two way to delete a spatial value from an object in the database:

  1. Using Backendless Console
  2. Using API

Deleting Data with Console

To delete a spatial value in console, simply clear out the contents of a cell and press Enter. Backendless Console confirms that the object has been updated:


Deleting Data with the API

Deleting a spatial value from an object using the API is technically the object update operation with the spatial value property set to null. The following algorithm can be used to perform deletion:

  1. Retrieve from the database the data object which contains the spatial property to be deleted.
  2. Set the property value to null.
  3. Save the object back in the database.

The example below demonstrates the approach:"Person").findFirst().then((firstPerson) {
 firstPerson["location"] = null;"Person").save(firstPerson).then((response) {
   print("location has been deleted");

Person class:

import 'package:backendless_sdk/backendless_sdk.dart';

class Person {
 Point location;
Code to delete location in a Person object:<Person>().findFirst().then((firstPerson) {
 firstPerson.location = null;<Person>().save(firstPerson).then((response) {
   print("location has been deleted");

Alternatively, the same result can be achieved using the bulk update API operation. With this approach you can delete a spatial property either in a single or multiple objects. This is done with a query (the where clause) used in the API request. For example, the following query uniquely identifies a single object: objectId = 'XXX-XXX-XXX'. Consider an example demonstrating the approach:

var whereClause = "email = ''";
var changes = {"location": null};"Person").update(whereClause, changes).then((objectsUpdated) {
 print("objectsUpdated is how many objects were updated by the API call");

Codeless Reference

Consider the following records stored in the data table called geolocation:


Suppose you need to remove the geolocation data from the record, while leaving the value in the location column "blank". Note, that when there is no value in the column and it is "blank", the column actually contains the null value. So to delete the contents of the record, we must update the value in a specific column to the null. The example below "deletes" the current geolocation  data only for one object.



Argument                Description
table name Name of the data table where a new record must be deleted(updated).
object An object to save in the database. Object properties must match the names of the table columns.
return result Optional parameter. When this box is checked, the operation returns the deleted(updated) object with the objectId property.

After the operation runs, the value gets deleted(replaced with the null value).


To delete geolocation data for multiple records, you have to use the Bulk Update Codeless block. In this case you must establish the where clause condition to allow the operation to find objects that must be delete(updated). As it was described above, the deletion result is achieved when a column is updated with the null value. The null indicates that a specific column contains no value.

The example below deletes the geolocation data for two objects in the data table. The where clause property contains the following condition:

objectId = 'E0236915-54CE-45DE-AC65-6F2093AC6ADF' OR objectId = 'F77A8ACE-EF6E-405F-9B31-E495E897D0D6'

As you can see, we have to reference two objectId values and also use the OR operator.



Argument                Description
table name Name of the data table where records must be deleted(updated).
where clause A condition which references a column name and a specific value in the data table where an update/deletion has to be carried out. Refer to the Search With The Where Clause topic for more information.
changes This parameter expects an object that must contain the name of the column and a new value to update the existing contents with.
Return count of updated objects Optional parameter. When this box is checked, the operation returns the number of deleted(updated) objects.

The operation has successfully deleted(updated) the contents in the location column for two objects.