I am using below code to fetch nearest location from PointField using MongoEngine
restra = ResLocation.objects(point__near=[lat, lon], point__max_distance=distance)
all_res = []
for res in restra:
all_res += [
{
"res_name": res.res_name,
"res_address": res.res_address
}
]
While I am getting below error InvalidQueryError: Cannot resolve field "point"
How can I solve this please suggest
I solved the problem , it was a silly mistake from my side , posting here so that I can save someone else time
point__near
replaced with loc__near
where loc is column name of the PointField
in model class