This set of MongoDB Multiple Choice Questions & Answers (MCQs) focuses on “Geospatial Index”.
1. ___________ selects geometries that intersect with a GeoJSON geometry.
a) $near
b) $nearsphere
c) $geoIntersect
d) None of the mentioned
View Answer
Explanation: The 2dsphere index supports $geoIntersects.
2. Point out the wrong statement.
a) If $near or $nearSphere query specifies the center point as a GeoJSON point, specify the distance as a non-negative number in meters
b) If $nearSphere query specifies the center point as legacy coordinate pair, specify the distance as a non-negative number in radians
c) $near can only use the 2dsphere index if the query specifies the center point as a GeoJSON point
d) None of the mentioned
View Answer
Explanation:$minDistance filters the results of a geospatial $near or $nearSphere query to those documents that are at least the specified distance from the center point.
3. _______ returns geospatial objects in proximity to a point.
a) $near
b) $nearsphere
c) $geoIntersect
d) None of the mentioned
View Answer
Explanation:$near requires a geospatial index.
4. _________ specifies a geometry in GeoJSON format to geospatial query operators.
a) $sphere
b) $geoin
c) $geometry
d) All of the mentioned
View Answer
Explanation:$geometry uses EPSG:4326 as the default coordinate reference system (CRS).
5. Point out the correct statement.
a) Both 2dsphere and 2d geospatial indexes support $geoWithin
b) $geoWithin does not require a geospatial index
c) The $geoWithin operator does not return sorted results
d) None of the mentioned
View Answer
Explanation: However, a geospatial index will improve query performance.
6. _________ returns geospatial objects in proximity to a point on a sphere. Requires a geospatial index.
a) $near
b) $nearsphere
c) $geoIntersect
d) None of the mentioned
View Answer
Explanation: The 2dsphere and 2d indexes support $nearSphere.
7. __________ specifies a minimum distance to limit the results of $near and $nearSphere queries.
a) $center
b) $maxDistance
c) $minDistance
d) All of the mentioned
View Answer
Explanation:$minDistance is available for use with 2dsphere index only.
8. The _________ operator specifies a circle for a $geoWithin query.
a) $within
b) $gwithin
c) $center
d) All of the mentioned
View Answer
Explanation: The query returns legacy coordinate pairs that are within the bounds of the circle.
9. ________ index must exist on a field holding coordinates before using any of the geospatial query operators.
a) Unique
b) Geospatial
c) Temporal
d) All of the mentioned
View Answer
Explanation: Only the 2d geospatial index supports $center.
Sanfoundry Global Education & Learning Series – MongoDB.
Here’s the list of Best Books in MongoDB.
- Check Information Technology Books
- Check MongoDB Books
- Practice Programming MCQs
- Apply for Programming Internship