New Pipeline From Text tool should be more flexible
In Compass' "Aggregations" tab users can select the option "New Pipeline From Text"
This accepts pasting in a pipeline like:
[
....
]
However, it doesn't accept pasting in a pipeline with the original variable definition, like:
var mypipeline = [
....
];
This is an annoying paper-cut when people are pasting in a pipeline they've previously been editing/using somewhere else. For an example, see the 'var pipeline = [..];' copyable code snippet in the Practical MongoDB Aggregations book at: https://www.practical-mongodb-aggregations.com/examples/foundational/filtered-top-subset.html#aggregation-pipeline
The tool should allow a variable definition to precede [...], where the variable can have any name and may be declared with 'var', 'let', 'const' or <none> qualifiers. Also, the tool should not reject the pipeline if it is followed by a Javascript ';' terminator (regardless of whether the pipeline has been preceded with a variable definition or not).