diff options
author | Mathias Stearn <mathias@10gen.com> | 2017-06-29 11:54:45 -0400 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2017-07-03 19:07:13 -0400 |
commit | 477d732d98bd12fe34f45a582746e5d40f2636e5 (patch) | |
tree | d56c71d3b57eafcfc4b20febdb5c2fc965960ebf /src/mongo/db/pipeline/document.cpp | |
parent | 5b83e73d2ec0165b15fd2e47f300b076d279f0c3 (diff) | |
download | mongo-477d732d98bd12fe34f45a582746e5d40f2636e5.tar.gz |
SERVER-29925 Only canonicalize bson types if they differ
Diffstat (limited to 'src/mongo/db/pipeline/document.cpp')
-rw-r--r-- | src/mongo/db/pipeline/document.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/mongo/db/pipeline/document.cpp b/src/mongo/db/pipeline/document.cpp index e12b781ba5b..835ae1bc716 100644 --- a/src/mongo/db/pipeline/document.cpp +++ b/src/mongo/db/pipeline/document.cpp @@ -412,10 +412,12 @@ int Document::compare(const Document& rL, // For compatibility with BSONObj::woCompare() consider the canonical type of values // before considerting their names. - const int rCType = canonicalizeBSONType(rField.val.getType()); - const int lCType = canonicalizeBSONType(lField.val.getType()); - if (lCType != rCType) - return lCType < rCType ? -1 : 1; + if (lField.val.getType() != rField.val.getType()) { + const int rCType = canonicalizeBSONType(rField.val.getType()); + const int lCType = canonicalizeBSONType(lField.val.getType()); + if (lCType != rCType) + return lCType < rCType ? -1 : 1; + } const int nameCmp = lField.nameSD().compare(rField.nameSD()); if (nameCmp) |