summaryrefslogtreecommitdiff
path: root/src/mongo/rpc/command_reply.cpp
diff options
context:
space:
mode:
authorDavid Storch <david.storch@10gen.com>2016-08-12 15:58:56 -0400
committerDavid Storch <david.storch@10gen.com>2016-08-18 11:14:17 -0400
commit26543060c852aac22f26143a04bf7789ec8fec53 (patch)
treedf3ae49e5c4745058be29b7ec8a8e4b528b50a9a /src/mongo/rpc/command_reply.cpp
parent13fa28982d008568f7620d73ddec0c61fad7cbc8 (diff)
downloadmongo-26543060c852aac22f26143a04bf7789ec8fec53.tar.gz
SERVER-24508 BSONObj::ComparatorInterface
BSONObj instances should now be compared via the comparator interface's evaluate() method. This preferred over using BSONObj::woCompare() directly. If the comparison doesn't require any database semantics (e.g. there is no collation), there is a global instance of the SimpleBSONObjComparator which should be used for BSONObj comparisons. If the comparison requires special semantics, then callers must instantiate their own comparator object.
Diffstat (limited to 'src/mongo/rpc/command_reply.cpp')
-rw-r--r--src/mongo/rpc/command_reply.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mongo/rpc/command_reply.cpp b/src/mongo/rpc/command_reply.cpp
index 172e7ac1ebe..25a0ce58195 100644
--- a/src/mongo/rpc/command_reply.cpp
+++ b/src/mongo/rpc/command_reply.cpp
@@ -35,6 +35,7 @@
#include "mongo/base/data_range_cursor.h"
#include "mongo/base/data_type_validated.h"
+#include "mongo/bson/simple_bsonobj_comparator.h"
#include "mongo/rpc/object_check.h"
#include "mongo/util/net/message.h"
@@ -76,8 +77,10 @@ Protocol CommandReply::getProtocol() const {
}
bool operator==(const CommandReply& lhs, const CommandReply& rhs) {
- return std::tie(lhs._metadata, lhs._commandReply, lhs._outputDocs) ==
- std::tie(rhs._metadata, rhs._commandReply, rhs._outputDocs);
+ SimpleBSONObjComparator bsonComparator;
+ return bsonComparator.evaluate(lhs._metadata == rhs._metadata) &&
+ bsonComparator.evaluate(lhs._commandReply == rhs._commandReply) &&
+ (lhs._outputDocs == rhs._outputDocs);
}
bool operator!=(const CommandReply& lhs, const CommandReply& rhs) {