For an unsharded collection, the following explain command runs successfully.
{ explain: {find: collName, filter: {$expr: {$eq: ["$x", "$$var"]}}, let : {var : 1}} }
However, for a sharded collection, it fails with the following error:
{"ok" : 0, "errmsg" : "Use of undefined variable: var", "code" : 17276, "codeName" : "Location17276"}
The behavior is the same on the 6.0 branch.
- is related to
-
SERVER-71636 Explain executionStats does not work for $lookup on sharded collection
- Closed
-
SERVER-75927 Shards see different values for 'let' parameter when using $rand
- Closed
- related to
-
SERVER-76037 Write commands using updateOne without shard key path fails spuriously when predicate refers to 'let' parameter
- Closed