Hi guys, I have related table and I am performing advanced sql search query. Everything worked perfectly, but now I realised that if I try to perform search based on geopoint relation. Example:
distance(36.7718159040103,-121.263838671148, location.latitude, location.longitude) < km(2985.91)
I will get response like this:
{
"offset": 0,
"data": [
{
"owner": {
"notes": "fsdfs",
"color": "#44902d",
"year": "2004",
"created": 1477729446000,
"destinations": [],
"photo": "https://api.backendless.com/d33cd664-1ee3-401f-ff16-e3b50d22b700/v1/files/cars/b2403d8657914e0b81a4ff0d3875a38a.jpg",
"weight": 423,
"styleName": null,
"ownerId": "46970B30-1AAA-58D9-FF9E-293A9EE3E200",
"type": 1,
"sizeX": 423,
"price": 0,
"___class": "UserCars",
"style": null,
"model": "H1",
"spz": "fsdfs",
"make": "Hummer",
"updated": 1479515665000,
"sizeY": 4242,
"objectId": "0FFA80A4-2DD0-9BF4-FFBB-66E575488E00",
"sizeZ": 424
},
"delivery": null,
"notes": null,
"created": 1479515665000,
"ownerId": "46970B30-1AAA-58D9-FF9E-293A9EE3E200",
"space": 1,
"price": 76,
"___class": "Cars",
"pickupDate": 1479522853000,
"client": null,
"location": {
"metadata": {
"placeAddress": "830 Market St, San Francisco, CA 94102, USA",
"placeID": "ChIJMdyyA4aAhYARQJkIHUD4fXI",
"placeName": "GameStop"
},
"distance": 151579.43331653028,
"latitude": 37.7854165,
"___class": "GeoPoint",
"categories": [
"Goods"
],
"objectId": "C82B26CC-7A35-59D9-FFEF-BF185CB79600",
"longitude": -122.40660609999998
},
"deliveryDate": 1481502849000,
"updated": null,
"objectId": "2858D288-24B1-5956-FFB8-E5F82C9B9200",
"status": 0
},
{
"owner": {
"notes": "fsdfs",
"color": "#44902d",
"year": "2004",
"created": 1477729446000,
"destinations": [],
"photo": "https://api.backendless.com/d33cd664-1ee3-401f-ff16-e3b50d22b700/v1/files/cars/b2403d8657914e0b81a4ff0d3875a38a.jpg",
"weight": 423,
"styleName": null,
"ownerId": "46970B30-1AAA-58D9-FF9E-293A9EE3E200",
"type": 1,
"sizeX": 423,
"price": 0,
"___class": "UserCars",
"style": null,
"model": "H1",
"spz": "fsdfs",
"make": "Hummer",
"updated": 1479515665000,
"sizeY": 4242,
"objectId": "0FFA80A4-2DD0-9BF4-FFBB-66E575488E00",
"sizeZ": 424
},
"delivery": null,
"notes": null,
"created": 1479515665000,
"ownerId": "46970B30-1AAA-58D9-FF9E-293A9EE3E200",
"space": 1,
"price": 76,
"___class": "Cars",
"pickupDate": 1479522853000,
"client": null,
"location": {
"metadata": {
"placeAddress": "830 Market St, San Francisco, CA 94102, USA",
"placeID": "ChIJMdyyA4aAhYARQJkIHUD4fXI",
"placeName": "GameStop"
},
"distance": 151579.43331653028,
"latitude": 37.7854165,
"___class": "GeoPoint",
"categories": [
"Goods"
],
"objectId": "C82B26CC-7A35-59D9-FFEF-BF185CB79600",
"longitude": -122.40660609999998
},
"deliveryDate": 1481502849000,
"updated": null,
"objectId": "2858D288-24B1-5956-FFB8-E5F82C9B9200",
"status": 0
},
{
"owner": {
"notes": "fsdfs",
"color": "#44902d",
"year": "2004",
"created": 1477729446000,
"destinations": [],
"photo": "https://api.backendless.com/d33cd664-1ee3-401f-ff16-e3b50d22b700/v1/files/cars/b2403d8657914e0b81a4ff0d3875a38a.jpg",
"weight": 423,
"styleName": null,
"ownerId": "46970B30-1AAA-58D9-FF9E-293A9EE3E200",
"type": 1,
"sizeX": 423,
"price": 0,
"___class": "UserCars",
"style": null,
"model": "H1",
"spz": "fsdfs",
"make": "Hummer",
"updated": 1479515665000,
"sizeY": 4242,
"objectId": "0FFA80A4-2DD0-9BF4-FFBB-66E575488E00",
"sizeZ": 424
},
"delivery": null,
"notes": null,
"created": 1479515665000,
"ownerId": "46970B30-1AAA-58D9-FF9E-293A9EE3E200",
"space": 1,
"price": 76,
"___class": "Cars",
"pickupDate": 1479522853000,
"client": null,
"location": {
"metadata": {
"placeAddress": "830 Market St, San Francisco, CA 94102, USA",
"placeID": "ChIJMdyyA4aAhYARQJkIHUD4fXI",
"placeName": "GameStop"
},
"distance": 151579.43331653028,
"latitude": 37.7854165,
"___class": "GeoPoint",
"categories": [
"Goods"
],
"objectId": "C82B26CC-7A35-59D9-FFEF-BF185CB79600",
"longitude": -122.40660609999998
},
"deliveryDate": 1481502849000,
"updated": null,
"objectId": "2858D288-24B1-5956-FFB8-E5F82C9B9200",
"status": 0
}
],
"nextPage": null,
"totalObjects": 3
}
As you can seen in related table “Cars” is only one entry with objID: “objectId”: “2858D288-24B1-5956-FFB8-E5F82C9B9200”,
But APi returns 3 identical objects!!!