|
The extraction of multiple top level fields can be represented in an SBE plan either as a series of getField() calls, or as a single scan over several slots.
Here is an example of the former (outputted by Bonsai):
[5] filter {shardFilter(s5, makeBsonObj(MakeObjSpec(drop, [], ["a", "b", "c"]), Nothing, s2, s3, s4))}
|
[4] project [s4 = getField(s1, "c")]
|
[3] project [s3 = getField(s1, "b")]
|
[2] project [s2 = getField(s1, "a")]
|
[1] scan s1 none none none none none none none lowPriority [] @"<collUUID>" true false
|
And of the latter (outputted by Stage Builders):
filter {shardFilter(s5, makeBsonObj(MakeObjSpec(drop, [], ["a", "b", "c"]), Nothing, s2, s3, s4))}
|
scan [s2 = a, s3 = b, s4 = c]
|
The latter is far more efficient, and should be the behavior of Bonsai-generated plans as part of CQF.
|