Skip to content

Commit 400f006

Browse files
committed
SERVER-12038 PipelineD::prepareCursorSource resilient to CQ failure
Query clients should check return value of canonicalize (since e.g. queries with $meta sort but no $meta projection should fail to canonicalize).
1 parent 320397d commit 400f006

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/mongo/db/pipeline/pipeline_d.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,14 +203,14 @@ namespace {
203203
CanonicalQuery* cq;
204204
// Passing an empty projection since it is faster to use documentFromBsonWithDeps.
205205
// This will need to change to support covering indexes (SERVER-12015).
206-
uassertStatusOK(
206+
Status status =
207207
CanonicalQuery::canonicalize(pExpCtx->ns,
208208
queryObj,
209209
sortObj,
210210
needQueryProjection ? projection : BSONObj(),
211-
&cq));
211+
&cq);
212212
Runner* rawRunner;
213-
if (getRunner(cq, &rawRunner, runnerOptions).isOK()) {
213+
if (status.isOK() && getRunner(cq, &rawRunner, runnerOptions).isOK()) {
214214
// success: The Runner will handle sorting for us using an index.
215215
runner.reset(rawRunner);
216216
sortInRunner = true;

0 commit comments

Comments
 (0)