diff options
Diffstat (limited to 'src/mongo/db/query/query_request.cpp')
-rw-r--r-- | src/mongo/db/query/query_request.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/mongo/db/query/query_request.cpp b/src/mongo/db/query/query_request.cpp index dc8188ab96a..04c4154f741 100644 --- a/src/mongo/db/query/query_request.cpp +++ b/src/mongo/db/query/query_request.cpp @@ -964,10 +964,6 @@ StatusWith<BSONObj> QueryRequest::asAggregationCommand() const { return {ErrorCodes::InvalidPipelineOperator, str::stream() << "Option " << kReturnKeyField << " not supported in aggregation."}; } - if (!_comment.empty()) { - return {ErrorCodes::InvalidPipelineOperator, - str::stream() << "Option " << kCommentField << " not supported in aggregation."}; - } if (_showRecordId) { return {ErrorCodes::InvalidPipelineOperator, str::stream() << "Option " << kShowRecordIdField @@ -1064,6 +1060,9 @@ StatusWith<BSONObj> QueryRequest::asAggregationCommand() const { if (!_hint.isEmpty()) { aggregationBuilder.append("hint", _hint); } + if (!_comment.empty()) { + aggregationBuilder.append("comment", _comment); + } return StatusWith<BSONObj>(aggregationBuilder.obj()); } } // namespace mongo |