0
0
MongoDBquery~5 mins

Geospatial queries basics in MongoDB - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a geospatial query in MongoDB?
A geospatial query in MongoDB is a way to find documents based on their location data, such as points on a map, using coordinates like latitude and longitude.
Click to reveal answer
beginner
Which MongoDB index type is used for 2D geospatial queries?
The '2d' index type is used for flat, two-dimensional geospatial queries on legacy coordinate pairs.
Click to reveal answer
beginner
What does the $near operator do in a geospatial query?
The $near operator finds documents with locations closest to a specified point, sorting results by distance from that point.
Click to reveal answer
intermediate
Explain the difference between '2d' and '2dsphere' indexes in MongoDB.
'2d' indexes work with flat coordinate systems for simple x,y points, while '2dsphere' indexes support spherical geometry for Earth-like curved surfaces and GeoJSON data.
Click to reveal answer
intermediate
What is GeoJSON and why is it important in MongoDB geospatial queries?
GeoJSON is a format for encoding geographic data structures like points, lines, and polygons. MongoDB uses GeoJSON with '2dsphere' indexes to perform accurate spherical geospatial queries.
Click to reveal answer
Which MongoDB operator finds documents near a specific point?
A$geoWithin
B$near
C$geoIntersects
D$match
What type of index should you create for spherical Earth data in MongoDB?
A2d
Btext
C2dsphere
Dhashed
Which format does MongoDB use to store complex geospatial shapes like polygons?
AGeoJSON
BXML
CCSV
DJSON
What does the $geoWithin operator do?
AFinds documents near a point
BSorts documents by distance
CFinds documents intersecting a line
DFinds documents within a specified shape
Which index type is best for legacy flat coordinate pairs?
A2d
B2dsphere
Ctext
Dhashed
Describe how MongoDB uses geospatial indexes to perform location-based queries.
Think about how maps can be flat or round like the Earth.
You got /3 concepts.
    Explain the role of GeoJSON in MongoDB geospatial queries and why it matters.
    GeoJSON is like a language for describing shapes on maps.
    You got /3 concepts.