Support Topics Documentation Slack YouTube Blog

Delete unrelated Geolocation

(Martin Krajčír) #1

is there any query option for Backendless Console to delete all unrelated Geolocation? Some of my Geolocations are not needed because of lost relation to Data object (because of deletion). So I want to delete these geopoints.
Thanks for any help.

(Ilya Veklenko) #2

Hi Martin,

As I know, there is not a simple way to do it but I can suggest you an inelegant one.
If have metadata-relations to a data table in each Geo points you can select all points and then filter those don’t have a relation in the metadata. The simplest code example in JS:

var query = new Backendless.GeoQuery();
query.categories = ['my_geo'];
query.includeMetadata = true;

Backendless.Geo.find(query).then(onSuccess, onError);

function onSuccess(data) {
console.log(data.filter(function(item) {
return !item.metadata || !item.metadata.rel

function onError(err) {
console.log('error message - ' + err.message);
console.log('error code - ' + err.statusCode);

Where ‘rel’ is a relation property name and ‘my_geo’ is a name of geo category.
Please note, I did not handle the pagination.

Please, let me know here if it helps or maybe I misunderstood you.

Regards Ilya