Working on the optional lab $map
example in Mongo Compass.
In the example $map
uses a variable $$writer
in the as
argument, and the document’s feature is called writers
.
In Compass the $$writer
variable was auto-complete available in the Compass editor, but error checking said it was undefined. (see below).
So I take it the $$writer
variable is only in scope for the $map
operator?
{
$project: {
writers: {
$map: {
input: "$writers",
as: "writer",
in: {
$arrayElemAt: [
{
$split: ["$$writer", " ("]
},
0
]
}
}
}
}
},