summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/cursor_response.h
diff options
context:
space:
mode:
authorTed Tuckman <ted.tuckman@mongodb.com>2022-03-02 22:20:32 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-03-02 23:11:24 +0000
commitf25675cc8ea9d89672ce063f49dbdaa39e63ce1b (patch)
treeb1867e1b1e3db4dc5083da673bd62aa4cc218767 /src/mongo/db/query/cursor_response.h
parent27ce39ba637159ae0be6e7734b1d7f114af7141c (diff)
downloadmongo-f25675cc8ea9d89672ce063f49dbdaa39e63ce1b.tar.gz
SERVER-62535 Allow sharded aggregation to return two cursors
Diffstat (limited to 'src/mongo/db/query/cursor_response.h')
-rw-r--r--src/mongo/db/query/cursor_response.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/mongo/db/query/cursor_response.h b/src/mongo/db/query/cursor_response.h
index ca81974e78b..a8151d7709a 100644
--- a/src/mongo/db/query/cursor_response.h
+++ b/src/mongo/db/query/cursor_response.h
@@ -142,13 +142,17 @@ private:
* and appends the response object to the provided builder under the field name "cursor".
*
* The response object has the following format:
- * { id: <NumberLong>, ns: <String>, firstBatch: <Array> }.
+ * { id: <NumberLong>, ns: <String>, firstBatch: <Array> , type: <String>}.
+ *
+ * The type field is optional, but can be used to differentiate cursors if multiple are returned
+ * at once.
*
* This function is deprecated. Prefer CursorResponseBuilder or CursorResponse::toBSON() instead.
*/
void appendCursorResponseObject(long long cursorId,
StringData cursorNamespace,
BSONArray firstBatch,
+ boost::optional<StringData> cursorType,
BSONObjBuilder* builder);
/**
@@ -207,6 +211,7 @@ public:
boost::optional<BSONObj> postBatchResumeToken = boost::none,
boost::optional<BSONObj> writeConcernError = boost::none,
boost::optional<BSONObj> varsField = boost::none,
+ boost::optional<std::string> cursorType = boost::none,
bool partialResultsReturned = false,
bool invalidated = false);
@@ -249,6 +254,10 @@ public:
return _varsField;
}
+ auto getCursorType() const {
+ return _cursorType;
+ }
+
bool getPartialResultsReturned() const {
return _partialResultsReturned;
}
@@ -274,6 +283,7 @@ private:
boost::optional<BSONObj> _postBatchResumeToken;
boost::optional<BSONObj> _writeConcernError;
boost::optional<BSONObj> _varsField;
+ boost::optional<std::string> _cursorType;
bool _partialResultsReturned = false;
bool _invalidated = false;
};