diff options
Diffstat (limited to 'src/mongo/db/geo')
-rw-r--r-- | src/mongo/db/geo/SConscript | 1 | ||||
-rw-r--r-- | src/mongo/db/geo/geoparser.cpp | 13 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/mongo/db/geo/SConscript b/src/mongo/db/geo/SConscript index 9c8e13d1268..ca2d94c7349 100644 --- a/src/mongo/db/geo/SConscript +++ b/src/mongo/db/geo/SConscript @@ -16,6 +16,7 @@ env.Library("geoparser", [ "geoparser.cpp", "geometry_container.cpp" ], LIBDEPS = [ "geometry", "$BUILD_DIR/mongo/base", + "$BUILD_DIR/mongo/db/bson/dotted_path_support", "$BUILD_DIR/third_party/s2/s2" ]) env.CppUnitTest("hash_test", [ "hash_test.cpp" ], diff --git a/src/mongo/db/geo/geoparser.cpp b/src/mongo/db/geo/geoparser.cpp index 7e58a768aa8..2be29d1dd7a 100644 --- a/src/mongo/db/geo/geoparser.cpp +++ b/src/mongo/db/geo/geoparser.cpp @@ -34,6 +34,7 @@ #include <string> #include <vector> +#include "mongo/db/bson/dotted_path_support.h" #include "mongo/db/geo/shapes.h" #include "mongo/db/jsobj.h" #include "mongo/util/log.h" @@ -47,6 +48,8 @@ namespace mongo { using std::unique_ptr; using std::stringstream; +namespace dps = ::mongo::dotted_path_support; + // This field must be present, and... static const string GEOJSON_TYPE = "type"; // Have one of these values: @@ -525,7 +528,7 @@ Status GeoParser::parseMultiPoint(const BSONObj& obj, MultiPointWithCRS* out) { return status; out->points.clear(); - BSONElement coordElt = obj.getFieldDotted(GEOJSON_COORDINATES); + BSONElement coordElt = dps::extractElementAtPath(obj, GEOJSON_COORDINATES); status = parseArrayOfCoordinates(coordElt, &out->points); if (!status.isOK()) return status; @@ -546,7 +549,7 @@ Status GeoParser::parseMultiLine(const BSONObj& obj, bool skipValidation, MultiL if (!status.isOK()) return status; - BSONElement coordElt = obj.getFieldDotted(GEOJSON_COORDINATES); + BSONElement coordElt = dps::extractElementAtPath(obj, GEOJSON_COORDINATES); if (Array != coordElt.type()) return BAD_VALUE("MultiLineString coordinates must be an array"); @@ -576,7 +579,7 @@ Status GeoParser::parseMultiPolygon(const BSONObj& obj, if (!status.isOK()) return status; - BSONElement coordElt = obj.getFieldDotted(GEOJSON_COORDINATES); + BSONElement coordElt = dps::extractElementAtPath(obj, GEOJSON_COORDINATES); if (Array != coordElt.type()) return BAD_VALUE("MultiPolygon coordinates must be an array"); @@ -668,7 +671,7 @@ Status GeoParser::parseCenterSphere(const BSONObj& obj, CapWithCRS* out) { Status GeoParser::parseGeometryCollection(const BSONObj& obj, bool skipValidation, GeometryCollection* out) { - BSONElement coordElt = obj.getFieldDotted(GEOJSON_GEOMETRIES); + BSONElement coordElt = dps::extractElementAtPath(obj, GEOJSON_GEOMETRIES); if (Array != coordElt.type()) return BAD_VALUE("GeometryCollection geometries must be an array"); @@ -780,7 +783,7 @@ GeoParser::GeoSpecifier GeoParser::parseGeoSpecifier(const BSONElement& type) { } GeoParser::GeoJSONType GeoParser::parseGeoJSONType(const BSONObj& obj) { - BSONElement type = obj.getFieldDotted(GEOJSON_TYPE); + BSONElement type = dps::extractElementAtPath(obj, GEOJSON_TYPE); if (String != type.type()) { return GeoParser::GEOJSON_UNKNOWN; } |