summaryrefslogtreecommitdiff
path: root/src/mongo/db/api_parameters.h
diff options
context:
space:
mode:
authorA. Jesse Jiryu Davis <jesse@mongodb.com>2020-09-30 19:09:25 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-10-01 00:53:05 +0000
commite66093f0a8ee3cd95dea9480028a6da814bb1854 (patch)
tree26188bdb68b5b0dc7465c10ccfe219c3350204be /src/mongo/db/api_parameters.h
parent5ed3f46d7bc27a909a82bb9d469730300b2e1e60 (diff)
downloadmongo-e66093f0a8ee3cd95dea9480028a6da814bb1854.tar.gz
SERVER-50375 Thoroughly test that mongos forwards API parameters
Diffstat (limited to 'src/mongo/db/api_parameters.h')
-rw-r--r--src/mongo/db/api_parameters.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/mongo/db/api_parameters.h b/src/mongo/db/api_parameters.h
index efbebfabfcc..34c129bca15 100644
--- a/src/mongo/db/api_parameters.h
+++ b/src/mongo/db/api_parameters.h
@@ -49,6 +49,11 @@ public:
static APIParameters fromClient(const APIParametersFromClient& apiParamsFromClient);
static APIParameters fromBSON(const BSONObj& cmdObj);
+ // For use with unordered_map.
+ struct Hash {
+ std::size_t operator()(const APIParameters& params) const;
+ };
+
void appendInfo(BSONObjBuilder* builder) const;
const boost::optional<std::string>& getAPIVersion() const {
@@ -85,6 +90,14 @@ private:
boost::optional<bool> _apiDeprecationErrors;
};
+inline bool operator==(const APIParameters& lhs, const APIParameters& rhs) {
+ return lhs.getAPIVersion() == rhs.getAPIVersion() && lhs.getAPIStrict() == rhs.getAPIStrict() &&
+ lhs.getAPIDeprecationErrors() == rhs.getAPIDeprecationErrors();
+}
+
+inline bool operator!=(const APIParameters& lhs, const APIParameters& rhs) {
+ return !(lhs == rhs);
+}
/**
* Temporarily remove the user's API parameters from an OperationContext.