summaryrefslogtreecommitdiff
path: root/src/mongo/db/api_parameters.h
diff options
context:
space:
mode:
authorA. Jesse Jiryu Davis <jesse@mongodb.com>2020-10-02 11:11:45 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-10-02 18:44:07 +0000
commit9b8d4c2f029e2384fa769014c00091e4de362ea4 (patch)
tree179772b6808276c49fb3c69d22c411993773dc09 /src/mongo/db/api_parameters.h
parent0b805a4119272e83f9ffe9bf7990397be9b0c7e9 (diff)
downloadmongo-9b8d4c2f029e2384fa769014c00091e4de362ea4.tar.gz
SERVER-50375 Ensure mongos forwards API parameters to shards
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.