0

lets say is have multiple docs with geo coordinates in mongodb

  • {"_id" : .., "userID" : "1", "point: {"type" : "Point", "coordinates" : [ 8.8502715, 45.6114064 ]}}
  • {"_id" : .., "userID" : "1", "point: {"type" : "Point", "coordinates" : [ 8.8402715, 45.6214064 ]}}
  • {"_id" : .., "userID" : "2", "point: {"type" : "Point", "coordinates" : [ 8.8512715, 45.6124064 ]}} {"_id" : .., "userID" : "3", "point: {"type" : "Point", "coordinates" : [ 8.8512715, 45.6124064 ]}}

and i want to run a test every 5 minutes and get all users that were in proximity of 20 meters with each other (so points of the same userid should be ignored. it will check maxDistance only between docs that have diffrent userid ). is there any query i can run that will provide all the points? if not, should i check for diffrent db to store points that i will be able to run this type of query?

Thanks in advance?

  • you can't do this just in Mongo, you'll have to iterate over the users in code and execute something like `$centerSphere` for each. you can improve performance a little by excluding users that you already ran on. – Tom Slabbaert Jul 11 '21 at 08:21
  • any geodatabase that can do this? or any data mininig fast algoritm that can do this? – itay regev Jul 14 '21 at 09:19

0 Answers0