Hi,
Please find below code snippet to fetch document based on geo query and let me know if it helps:
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>";
GeoTag gp = new GeoTag();
gp.SetLat(-73.99171);
gp.SetLng(40.738868);
storageService.SetGeoTag(gp);
GeoQuery query = QueryBuilder.BuildGeoQuery(gp, GeoOperator.NEAR, new BigDecimal(100));
App42Log.SetDebug(true); //Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService();
storageService.FindDocumentsByLocation(dbName, collectionName, query, new UnityCallBack());
public class UnityCallBack : App42CallBack
{
public void OnSuccess(object response)
{
Storage storage = (Storage) response;
IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList();
for(int i=0;i <jsonDocList.Count;i++)
{
App42Log.Console("objectId is " + jsonDocList[i].GetDocId());
App42Log.Console("jsonDoc is " + jsonDocList[i].GetJsonDoc());
}
}
public void OnException(Exception e)
{
App42Log.Console("Exception : " + e);
}
}
Regards,
Himanshu Sharma