Search two location points in one go using Mongodb -
say have document, looks
{loc:{start:[x,y],end:[x1,y1]}}
with 2dsphere index, , want search documents have same start , end points in 1 query. possible in mongodb?
a geospatial index can cover 1 field legacy coordinate pair (array 2 values) or valid geojson point, polygon or linestring. means can index either start-position or end-position geospatial index.
but not problem when searching exact match. 2dsphere index offers some additional geographical operators, when need test exact equality, don't need , can treat geo-coordinates plain old data. when add vanilla index on loc
field , use vanilla find()
values searching, matches.
Comments
Post a Comment