summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/pipeline/document.cpp6
-rw-r--r--src/mongo/db/pipeline/document_internal.h4
2 files changed, 5 insertions, 5 deletions
diff --git a/src/mongo/db/pipeline/document.cpp b/src/mongo/db/pipeline/document.cpp
index 43fdbf3b75d..725507ba432 100644
--- a/src/mongo/db/pipeline/document.cpp
+++ b/src/mongo/db/pipeline/document.cpp
@@ -217,7 +217,7 @@ namespace mongo {
void Document::toBson(BSONObjBuilder* pBuilder) const {
for (DocumentStorageIterator it = storage().iterator(); !it.atEnd(); it.advance()) {
- *pBuilder << it->name << it->val;
+ *pBuilder << it->nameSD() << it->val;
}
}
@@ -333,7 +333,7 @@ namespace mongo {
const ValueElement& rField = rIt.get();
const ValueElement& lField = lIt.get();
- const int nameCmp = strcmp(lField.name, rField.name);
+ const int nameCmp = lField.nameSD().compare(rField.nameSD());
if (nameCmp)
return nameCmp; // field names are unequal
@@ -354,7 +354,7 @@ namespace mongo {
const char* prefix = "{";
for (DocumentStorageIterator it = storage().iterator(); !it.atEnd(); it.advance()) {
- out << prefix << it->name << ": " << it->val.toString();
+ out << prefix << it->nameSD() << ": " << it->val.toString();
prefix = ", ";
}
out << '}';
diff --git a/src/mongo/db/pipeline/document_internal.h b/src/mongo/db/pipeline/document_internal.h
index eab7778e6b6..d639a5f262b 100644
--- a/src/mongo/db/pipeline/document_internal.h
+++ b/src/mongo/db/pipeline/document_internal.h
@@ -55,7 +55,7 @@ namespace mongo {
Value val;
Position nextCollision; // Position of next field with same hashBucket
const int nameLen; // doesn't include '\0'
- const char name[1]; // pointer to start of name
+ const char _name[1]; // pointer to start of name (use nameSD instead)
ValueElement* next() {
return align(plusBytes(sizeof(ValueElement) + nameLen));
@@ -65,7 +65,7 @@ namespace mongo {
return align(plusBytes(sizeof(ValueElement) + nameLen));
}
- StringData nameSD() const { return StringData(name, nameLen); }
+ StringData nameSD() const { return StringData(_name, nameLen); }
// helpers for doing pointer arithmetic with this class