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?
✗ Incorrect
$near finds documents closest to a given point, sorted by distance.
What type of index should you create for spherical Earth data in MongoDB?
✗ Incorrect
2dsphere indexes support spherical geometry and GeoJSON data.
Which format does MongoDB use to store complex geospatial shapes like polygons?
✗ Incorrect
GeoJSON is the standard format for geographic shapes in MongoDB.
What does the $geoWithin operator do?
✗ Incorrect
$geoWithin finds documents located inside a given geometry like a polygon.
Which index type is best for legacy flat coordinate pairs?
✗ Incorrect
2d indexes are designed for flat, two-dimensional coordinate pairs.
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.