Indonesian Journal of Electrical Engineering and Computer Science
Vol 44, No 1: October 2026

Comparing MongoDB spatial indexes for proximity queries

Mahmoud Hammadi (University of Mostaganem-Abdelhamid Ibn Badis)
Charef Abdallah Bensalloua (University of Mostaganem-Abdelhamid Ibn Badis)



Article Info

Publish Date
01 Oct 2026

Abstract

In this paper, we empirically compare MongoDB's three main geographical indexes: 2d, 2dsphere, and Geohash. We look at different data volumes and geographic distributions. Our goal is to see how each index behaves in practice. We assess the effects of spatial density (dense urban, suburban, and rural regions) on index reaction time, memory use, and construction time using a repeatable technique based on real-world OpenStreetMap datasets. The findings demonstrate that while Geohash provides useful flexibility in less populated regions, the 2dsphere index is best suited for dense metropolitan environments because of its geometric precision. For historical applications that span tiny, flat regions, the 2d index is still useful. Along with the code and data to reproduce the test, we offer useful suggestions for architects and developers.

Copyrights © 2026