summaryrefslogtreecommitdiff
path: root/src/mongo/db/views
diff options
context:
space:
mode:
authorRuoxin Xu <ruoxin.xu@mongodb.com>2021-01-13 23:19:33 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-01-20 13:29:03 +0000
commit9686cd9358b744877d43a2d7b71fdb91e40d3de9 (patch)
tree1277e37a62f3994335c537b9594049e07809440d /src/mongo/db/views
parent191aa3556e3fecd6cec1336ec346911109dc5223 (diff)
downloadmongo-9686cd9358b744877d43a2d7b71fdb91e40d3de9.tar.gz
SERVER-53311 Add a 'struct' type to represent 'cursor' object in aggregate command input IDL
Diffstat (limited to 'src/mongo/db/views')
-rw-r--r--src/mongo/db/views/resolved_view.cpp2
-rw-r--r--src/mongo/db/views/resolved_view_test.cpp8
2 files changed, 7 insertions, 3 deletions
diff --git a/src/mongo/db/views/resolved_view.cpp b/src/mongo/db/views/resolved_view.cpp
index bccc3562d06..d74f0bacbeb 100644
--- a/src/mongo/db/views/resolved_view.cpp
+++ b/src/mongo/db/views/resolved_view.cpp
@@ -100,7 +100,7 @@ AggregateCommand ResolvedView::asExpandedViewAggregation(const AggregateCommand&
if (request.getExplain()) {
expandedRequest.setExplain(request.getExplain());
} else {
- expandedRequest.setBatchSize(request.getBatchSize());
+ expandedRequest.setCursor(request.getCursor());
}
expandedRequest.setHint(request.getHint());
diff --git a/src/mongo/db/views/resolved_view_test.cpp b/src/mongo/db/views/resolved_view_test.cpp
index 0a795870986..95797376f28 100644
--- a/src/mongo/db/views/resolved_view_test.cpp
+++ b/src/mongo/db/views/resolved_view_test.cpp
@@ -90,13 +90,17 @@ TEST(ResolvedViewTest, ExpandingAggRequestPreservesExplain) {
TEST(ResolvedViewTest, ExpandingAggRequestWithCursorAndExplainOnlyPreservesExplain) {
const ResolvedView resolvedView{backingNss, emptyPipeline, kSimpleCollation};
AggregateCommand aggRequest{viewNss, {}};
- aggRequest.setBatchSize(10);
+ SimpleCursorOptions cursor;
+ cursor.setBatchSize(10);
+ aggRequest.setCursor(cursor);
aggRequest.setExplain(ExplainOptions::Verbosity::kExecStats);
auto result = resolvedView.asExpandedViewAggregation(aggRequest);
ASSERT(result.getExplain());
ASSERT(*result.getExplain() == ExplainOptions::Verbosity::kExecStats);
- ASSERT_EQ(result.getBatchSize(), aggregation_request_helper::kDefaultBatchSize);
+ ASSERT_EQ(
+ result.getCursor().getBatchSize().value_or(aggregation_request_helper::kDefaultBatchSize),
+ aggregation_request_helper::kDefaultBatchSize);
}
TEST(ResolvedViewTest, ExpandingAggRequestPreservesBypassDocumentValidation) {