summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/count_request.h
diff options
context:
space:
mode:
authorJames Wahlin <james.wahlin@10gen.com>2017-03-15 17:09:33 -0400
committerJames Wahlin <james.wahlin@10gen.com>2017-04-05 13:51:03 -0400
commitc3341d179db1c36722284676d99cb1c664fb1821 (patch)
treef69c9c00fc8df3ccf6db6df50a78319ff1e38950 /src/mongo/db/query/count_request.h
parent8765acc0fcc6ca3dd7158521ba8d864af4e0f2df (diff)
downloadmongo-c3341d179db1c36722284676d99cb1c664fb1821.tar.gz
SERVER-28040 Fix maxTimeMS/readPref/readConcern for sharded view query
Diffstat (limited to 'src/mongo/db/query/count_request.h')
-rw-r--r--src/mongo/db/query/count_request.h55
1 files changed, 47 insertions, 8 deletions
diff --git a/src/mongo/db/query/count_request.h b/src/mongo/db/query/count_request.h
index 0fd466ab93c..e1b951cb7de 100644
--- a/src/mongo/db/query/count_request.h
+++ b/src/mongo/db/query/count_request.h
@@ -54,7 +54,7 @@ public:
return _nss;
}
- const BSONObj getQuery() const {
+ BSONObj getQuery() const {
return _query;
}
@@ -74,13 +74,13 @@ public:
_skip = skip;
}
- const BSONObj getHint() const {
+ BSONObj getHint() const {
return _hint.value_or(BSONObj());
}
void setHint(BSONObj hint);
- const BSONObj getCollation() const {
+ BSONObj getCollation() const {
return _collation.value_or(BSONObj());
}
@@ -94,11 +94,37 @@ public:
_explain = explain;
}
- /**
- * Constructs a BSON representation of this request, which can be used for sending it in
- * commands.
- */
- BSONObj toBSON() const;
+ const std::string& getComment() const {
+ return _comment;
+ }
+
+ void setComment(StringData comment) {
+ _comment = comment.toString();
+ }
+
+ unsigned int getMaxTimeMS() const {
+ return _maxTimeMS;
+ }
+
+ void setMaxTimeMS(unsigned int maxTimeMS) {
+ _maxTimeMS = maxTimeMS;
+ }
+
+ BSONObj getReadConcern() const {
+ return _readConcern;
+ }
+
+ void setReadConcern(BSONObj readConcern) {
+ _readConcern = readConcern.getOwned();
+ }
+
+ BSONObj getUnwrappedReadPref() const {
+ return _unwrappedReadPref;
+ }
+
+ void setUnwrappedReadPref(BSONObj unwrappedReadPref) {
+ _unwrappedReadPref = unwrappedReadPref.getOwned();
+ }
/**
* Converts this CountRequest into an aggregation.
@@ -133,6 +159,19 @@ private:
// Optional. The collation used to compare strings.
boost::optional<BSONObj> _collation;
+ BSONObj _readConcern;
+
+ // The unwrapped readPreference object, if one was given to us by the mongos command processor.
+ // This object will be empty when no readPreference is specified or if the request does not
+ // originate from mongos.
+ BSONObj _unwrappedReadPref;
+
+ // When non-empty, represents a user comment.
+ std::string _comment;
+
+ // A user-specified maxTimeMS limit, or a value of '0' if not specified.
+ unsigned int _maxTimeMS = 0;
+
// If true, generate an explain plan instead of the actual count.
bool _explain = false;
};