Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Dynamic Fields - Point to Point Distance

default discord avatar
wmcmorrow2last year
1

I'm wondering whether it is possible to calculate the distance between two points in miles and return that as an attribute of requested documents. I think this would usually be done with aggregation in MongoDB. Is something like that possible? I may just do it in the front-end if not but curious if anyone has any thoughts on the best approach for this.

  • two points on the same doc? You could throw together another field that is stored on that doc and then use a beforeChange hook to calc the distance and store it on your new field

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.