Import Pipeline from Text从文本导入管道¶
On this page
New in version 1.15.0版本1.15.0中的新功能
You can import aggregation pipelines from plain text into the Aggregation Pipeline Builder to easily modify and execute your pipelines. 您可以将聚合管道从纯文本导入到聚合管道生成器中,以便轻松修改和执行管道。Importing a plain text aggregation pipeline shows how each stage of the pipeline affects the output, and illustrates the effects of modifying specific pipeline stages using the Pipeline Builder's Output panes.导入纯文本聚合管道显示管道的每个阶段如何影响输出,并说明使用管道生成器的输出窗格修改特定管道阶段的效果。
Syntax语法¶
The imported pipeline must be in the MongoDB query language (i.e. the same syntax used as the 导入的管道必须使用MongoDB查询语言(即使用与pipeline
parameter of the db.collection.aggregate() method). db.collection.aggregate()
方法的pipeline
参数相同的语法)。The imported pipeline must be an array, even if there is only one stage in the pipeline.导入的管道必须是数组,即使管道中只有一个阶段。
Procedure过程¶
Open the Aggregation Pipeline Builder for the desired collection.打开所需集合的聚合管道生成器。¶
Navigate to the collection for which you wish to import your aggregation pipeline. 导航到要为其导入聚合管道的集合。Click the Aggregations tab.单击“聚合”选项卡。
Open the New Pipeline From Plain Text dialog.打开“从纯文本新建管道”对话框。¶
Click the arrow next to the icon at the top of the pipeline builder.单击管道生成器顶部图标旁边的箭头。Click New Pipeline From Text.单击“从文本新建管道”。
Enter your pipeline in the dialog.在对话框中输入管道。¶
If you have a pre-written pipeline you wish to import into the Aggregation Pipeline Builder, copy it to your clipboard and paste it into the New Pipeline from Plain Text dialog. 如果您有要导入聚合管道生成器的预写管道,请将其复制到剪贴板,并将其粘贴到“从纯文本对话框新建管道”对话框中。Otherwise, type your pipeline in the input.否则,请在输入中键入管道。
Click Create New.单击“新建”。¶
Click Confirm to import your pipeline.单击“确认”导入管道。¶
Once you import your pipeline, you can add and modify individual stages and see the results reflected in the Output of each respective stage.导入管道后,可以添加和修改各个阶段,并查看每个阶段“输出”中反映的结果。