Leveraging geoJSON Across Collections

System Information

Latest docker image with MongoDB


I’m not sure how accurate my title is, but here we go.

I’m in the early stages of building out my Strapi backend, and wanted to get some guidance on the best approach. Here are my planned collections.

  • Locations
  • Location Categories
  • Providers
  • Provider Categories
  • Services
  • Service Categories

Here are the features I’d like to achieve:

  • Store geoJSON data on each location
  • Create a “Many-to-Many” relationship between Providers/Services/Locations
  • Query services with multiple filters, including geolocation and category
  • Use the geoJSON data tied to locations to filter the providers and services

So far, I have successfully been able to query the locations based on geolocation using the MongoDB “$geoNear” operator, but am struggling to leverage that same filter for providers/services. I’m hoping someone can point me in the right direction, since I fell that, while I may figure out some workarounds to achieving my goals, I doubt it will be the most efficient solution.

2 Likes

Were you able to find a solution? Facing a similar problem myself.