From 9686cd9358b744877d43a2d7b71fdb91e40d3de9 Mon Sep 17 00:00:00 2001 From: Ruoxin Xu Date: Wed, 13 Jan 2021 23:19:33 +0000 Subject: SERVER-53311 Add a 'struct' type to represent 'cursor' object in aggregate command input IDL --- src/mongo/db/views/resolved_view.cpp | 2 +- src/mongo/db/views/resolved_view_test.cpp | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'src/mongo/db/views') 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) { -- cgit v1.2.1