When performing a geospatial query, why do the `2d`, and `2dsphere` indexes yield different results for `$near` and `$nearSphere`?
IIUC, $near
calculates the Euclidean distance using latitude, and longitude (which I think would be an approximation), whereas $nearSphere
calculates the great-circle distance using latitude and longitude (which I think would be more accurate). I read that, depending on the index used (2d
, 2dsphere
), $near
and $nearSphere
could yield different results. Why is this? Wouldn’t the index only order the database to make the respective queries faster? For example if using the 2d
index, I would presume that the $near
query would be faster, and likewise for 2dsphere
and $nearSphere
. I wouldn’t expect that $near
with 2dsphere
would not be equal to $near
with 2d
, as was shown in the linked StackOverflow answer. What is causing this difference?
When performing a geospatial query, why do the `2d`, and `2dsphere` indexes yield different results for `$near` and `$nearSphere`?
IIUC, $near
calculates the Euclidean distance using latitude, and longitude (which I think would be an approximation), whereas $nearSphere
calculates the great-circle distance using latitude and longitude (which I think would be more accurate). I read that, depending on the index used (2d
, 2dsphere
), $near
and $nearSphere
could yield different results. Why is this? Wouldn’t the index only order the database to make the respective queries faster? For example if using the 2d
index, I would presume that the $near
query would be faster, and likewise for 2dsphere
and $nearSphere
. I wouldn’t expect that $near
with 2dsphere
would not be equal to $near
with 2d
, as was shown in the linked StackOverflow answer. What is causing this difference?
When performing a geospatial query, why do the `2d`, and `2dsphere` indexes yield different results for `$near` and `$nearSphere`?
IIUC, $near
calculates the Euclidean distance using latitude, and longitude (which I think would be an approximation), whereas $nearSphere
calculates the great-circle distance using latitude and longitude (which I think would be more accurate). I read that, depending on the index used (2d
, 2dsphere
), $near
and $nearSphere
could yield different results. Why is this? Wouldn’t the index only order the database to make the respective queries faster? For example if using the 2d
index, I would presume that the $near
query would be faster, and likewise for 2dsphere
and $nearSphere
. I wouldn’t expect that $near
with 2dsphere
would not be equal to $near
with 2d
, as was shown in the linked StackOverflow answer. What is causing this difference?
MongoDB comparison operators are not working properly [closed]
Closed 2 hours ago.
MongoDB comparison operators are not working properly [closed]
Closed 2 hours ago.
MongoDB comparison operators are not working properly [closed]
Closed 2 hours ago.
MongoDB comparison operators are not working properly [closed]
Closed 2 hours ago.
How to create wildcard index in monodb atlas search index?
I am using MongoDB Atlas, and my data is stored like this:
Is there performance issue if I use multiple “$set” in one update
The data in mongodb is like this
MongoDB: or in full text condition
I have data