summaryrefslogtreecommitdiff
path: root/src/mongo/bson/bsonobj.cpp
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/bson/bsonobj.cpp
parentf8f872e029ba3b1f32d8499c912756d48dc1a03b (diff)
downloadmongo-573921791c4d20e0d1603fd0a200d90d74b65bd5.tar.gz
SERVER-40476 remove mongoutils::str::equals
Diffstat (limited to 'src/mongo/bson/bsonobj.cpp')
-rw-r--r--src/mongo/bson/bsonobj.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/mongo/bson/bsonobj.cpp b/src/mongo/bson/bsonobj.cpp
index 29d07a5965b..376e32016ee 100644
--- a/src/mongo/bson/bsonobj.cpp
+++ b/src/mongo/bson/bsonobj.cpp
@@ -217,7 +217,7 @@ bool BSONObj::isFieldNamePrefixOf(const BSONObj& otherObj) const {
while (a.more() && b.more()) {
BSONElement x = a.next();
BSONElement y = b.next();
- if (!str::equals(x.fieldName(), y.fieldName())) {
+ if (x.fieldNameStringData() != y.fieldNameStringData()) {
return false;
}
}
@@ -382,26 +382,26 @@ Status BSONObj::storageValidEmbedded() const {
bool first = true;
while (i.more()) {
BSONElement e = i.next();
- const char* name = e.fieldName();
+ StringData name = e.fieldNameStringData();
// Cannot start with "$", unless dbref which must start with ($ref, $id)
- if (str::startsWith(name, '$')) {
+ if (name.startsWith("$")) {
if (first &&
// $ref is a collection name and must be a String
- str::equals(name, "$ref") &&
- e.type() == String && str::equals(i.next().fieldName(), "$id")) {
+ (name == "$ref") &&
+ e.type() == String && (i.next().fieldNameStringData() == "$id")) {
first = false;
// keep inspecting fields for optional "$db"
e = i.next();
- name = e.fieldName(); // "" if eoo()
+ name = e.fieldNameStringData(); // "" if eoo()
// optional $db field must be a String
- if (str::equals(name, "$db") && e.type() == String) {
+ if ((name == "$db") && e.type() == String) {
continue; // this element is fine, so continue on to siblings (if any more)
}
// Can't start with a "$", all other checks are done below (outside if blocks)
- if (str::startsWith(name, '$')) {
+ if (name.startsWith("$")) {
return Status(ErrorCodes::DollarPrefixedFieldName,
str::stream() << name << " is not valid for storage.");
}