Backendless Support
 
Need Answer

Delete unrelated Geolocation

Hello,

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.

Leave a Comment

Comments (1)

photo
1

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:

  1. var query = new Backendless.GeoQuery();
  2. query.categories = ['my_geo'];
  3. query.includeMetadata = true;
  4. Backendless.Geo.find(query).then(onSuccess, onError);
  5. function onSuccess(data) {
  6. console.log(data.filter(function(item) {
  7. return !item.metadata || !item.metadata.rel
  8. }));
  9. }
  10. function onError(err) {
  11. console.log('error message - ' + err.message);
  12. console.log('error code - ' + err.statusCode);
  13. }

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