This is not for geospatial data.
Each document has up to 10 integer values:
{ val1: 5,
val2: 8,
val3: -4,
...
How to find the 10 documents "nearest" { val1: 4, val2: -1, ... ?
I can see using $addField to create a distance for each document
{ $addFields: { distance: ($val1-4)^2 + ($val2+1)^2 ...
And then sorting and $limit...
But I'm not sure if this will be performant (although there are only 40K documents)...
Perhaps there is a better way?