summaryrefslogtreecommitdiff
path: root/src/mongo/db/matcher
diff options
context:
space:
mode:
authorBilly Donahue <billy.donahue@mongodb.com>2019-04-03 18:16:29 -0400
committerBilly Donahue <billy.donahue@mongodb.com>2019-04-08 12:15:08 -0400
commit573921791c4d20e0d1603fd0a200d90d74b65bd5 (patch)
tree9ec3957126fecc636cb31874376f09b6161965ff /src/mongo/db/matcher
parentf8f872e029ba3b1f32d8499c912756d48dc1a03b (diff)
downloadmongo-573921791c4d20e0d1603fd0a200d90d74b65bd5.tar.gz
SERVER-40476 remove mongoutils::str::equals
Diffstat (limited to 'src/mongo/db/matcher')
-rw-r--r--src/mongo/db/matcher/expression_geo.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/mongo/db/matcher/expression_geo.cpp b/src/mongo/db/matcher/expression_geo.cpp
index b25ee5cf19e..34596d34c45 100644
--- a/src/mongo/db/matcher/expression_geo.cpp
+++ b/src/mongo/db/matcher/expression_geo.cpp
@@ -40,9 +40,6 @@
namespace mongo {
-
-using mongoutils::str::equals;
-
//
// GeoExpression
//
@@ -80,7 +77,7 @@ Status GeoExpression::parseQuery(const BSONObj& obj) {
while (geoIt.more()) {
BSONElement elt = geoIt.next();
- if (str::equals(elt.fieldName(), "$uniqueDocs")) {
+ if (elt.fieldNameStringData() == "$uniqueDocs") {
// Deprecated "$uniqueDocs" field
warning() << "deprecated $uniqueDocs option: " << redact(obj);
} else {
@@ -175,8 +172,8 @@ bool GeoNearExpression::parseLegacyQuery(const BSONObj& obj) {
BSONObjIterator it(obj);
while (it.more()) {
BSONElement e = it.next();
- if (equals(e.fieldName(), "$near") || equals(e.fieldName(), "$geoNear") ||
- equals(e.fieldName(), "$nearSphere")) {
+ StringData fieldName = e.fieldNameStringData();
+ if ((fieldName == "$near") || (fieldName == "$geoNear") || (fieldName == "$nearSphere")) {
if (!e.isABSONObj()) {
return false;
}
@@ -186,17 +183,17 @@ bool GeoNearExpression::parseLegacyQuery(const BSONObj& obj) {
GeoParser::parsePointWithMaxDistance(embeddedObj, centroid.get(), &maxDistance)) {
uassert(18522, "max distance must be non-negative", maxDistance >= 0.0);
hasGeometry = true;
- isNearSphere = equals(e.fieldName(), "$nearSphere");
+ isNearSphere = (e.fieldNameStringData() == "$nearSphere");
}
- } else if (equals(e.fieldName(), "$minDistance")) {
+ } else if (fieldName == "$minDistance") {
uassert(16893, "$minDistance must be a number", e.isNumber());
minDistance = e.Number();
uassert(16894, "$minDistance must be non-negative", minDistance >= 0.0);
- } else if (equals(e.fieldName(), "$maxDistance")) {
+ } else if (fieldName == "$maxDistance") {
uassert(16895, "$maxDistance must be a number", e.isNumber());
maxDistance = e.Number();
uassert(16896, "$maxDistance must be non-negative", maxDistance >= 0.0);
- } else if (equals(e.fieldName(), "$uniqueDocs")) {
+ } else if (fieldName == "$uniqueDocs") {
warning() << "ignoring deprecated option $uniqueDocs";
} else {
// In a query document, $near queries can have no non-geo sibling parameters.
@@ -242,7 +239,8 @@ Status GeoNearExpression::parseNewQuery(const BSONObj& obj) {
BSONObjIterator it(e.embeddedObject());
while (it.more()) {
BSONElement e = it.next();
- if (equals(e.fieldName(), "$geometry")) {
+ StringData fieldName = e.fieldNameStringData();
+ if (fieldName == "$geometry") {
if (e.isABSONObj()) {
BSONObj embeddedObj = e.embeddedObject();
Status status = GeoParser::parseQueryPoint(e, centroid.get());
@@ -259,11 +257,11 @@ Status GeoNearExpression::parseNewQuery(const BSONObj& obj) {
(SPHERE == centroid->crs));
hasGeometry = true;
}
- } else if (equals(e.fieldName(), "$minDistance")) {
+ } else if (fieldName == "$minDistance") {
uassert(16897, "$minDistance must be a number", e.isNumber());
minDistance = e.Number();
uassert(16898, "$minDistance must be non-negative", minDistance >= 0.0);
- } else if (equals(e.fieldName(), "$maxDistance")) {
+ } else if (fieldName == "$maxDistance") {
uassert(16899, "$maxDistance must be a number", e.isNumber());
maxDistance = e.Number();
uassert(16900, "$maxDistance must be non-negative", maxDistance >= 0.0);