diff options
author | Mihai Andrei <mihai.andrei@10gen.com> | 2022-02-25 18:54:52 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-02-25 19:26:02 +0000 |
commit | 6d26e96928ddc1e58f875b223612458c2466ca02 (patch) | |
tree | d5fee5504b30ef0e0ffa6e076b8d62d4464a5016 /src/mongo | |
parent | 8696ce442652f7a69232b35901b73684bbcf7a88 (diff) | |
download | mongo-6d26e96928ddc1e58f875b223612458c2466ca02.tar.gz |
SERVER-63259 Update SEARCH_META comment in SBE stage builder
Diffstat (limited to 'src/mongo')
-rw-r--r-- | src/mongo/db/query/sbe_stage_builder.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/mongo/db/query/sbe_stage_builder.cpp b/src/mongo/db/query/sbe_stage_builder.cpp index a834cf2c42c..ad99a386b27 100644 --- a/src/mongo/db/query/sbe_stage_builder.cpp +++ b/src/mongo/db/query/sbe_stage_builder.cpp @@ -376,9 +376,11 @@ std::unique_ptr<sbe::RuntimeEnvironment> makeRuntimeEnvironment( auto [tag, val] = makeValue(cq.getExpCtx()->variables.getValue(id)); env->registerSlot(name, tag, val, true, slotIdGenerator); } else if (id == Variables::kSearchMetaId) { - // SEARCH_META never has a value at this point but can be set later and therefore must - // have a slot. The find layer is not responsible for setting this value. - auto [tag, val] = makeValue(cq.getExpCtx()->variables.getValue(id)); + // Normally, $search is responsible for setting a value for SEARCH_META, in which case + // we will bind the value to a slot above. However, in the event of a query that does + // not use $search, but references SEARCH_META, we need to bind a value of 'missing' to + // a slot so that the plan can run correctly. + auto [tag, val] = makeValue(Value()); env->registerSlot(name, tag, val, true, slotIdGenerator); } } |