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).
![](https://secure.gravatar.com/avatar/1f79d7ab24e17ca71c50356a0b66de35?size=40&default=https%3A%2F%2Fassets.uvcdn.com%2Fpkg%2Fadmin%2Ficons%2Fuser_70-6bcf9e08938533adb9bac95c3e487cb2a6d4a32f890ca6fdc82e3072e0ea0368.png)