Export Pipeline to Specific Language将管道导出到特定语言

New in version 1.15.0版本1.15.0中的新功能

You can use the Aggregation Pipeline Builder to export your finished pipeline to one of the supported languages; Java, Node, C#, and Python 3. 您可以使用聚合管道生成器将完成的管道导出到支持的语言之一;Java、Node、C#和Python 3。This feature facilitates formatting and exporting pipelines created in MongoDB Compass for use in your applications.此功能有助于格式化和导出MongoDB Compass中创建的管道,以便在应用程序中使用。

1

Navigate to the collection for which you wish to export your aggregation pipeline. 导航到要为其导出聚合管道的集合。Click the Aggregations tab.单击“聚合”选项卡。

2

For instructions on creating an aggregation pipeline in MongoDB Compass, see Aggregation Pipeline Builder.有关在MongoDB Compass中创建聚合管道的说明,请参阅聚合管道生成器

3
Aggregation Builder export dropdown
4

In the Export Pipeline To: dropdown, select your desired programming language:在“导出管道到:”下拉列表中,选择所需的编程语言:

Aggregation Builder language select

The My Pipeline pane on the left displays your pipeline in mongo shell syntax.左侧的“我的管道”窗格以mongo shell语法显示管道。

The pane to the right displays your pipeline in the selected programming language.右侧的窗格以所选编程语言显示管道。

5

Check the Include Import Statements option to include the required import statements for the selected programming language.选中“包括导入语句”选项以包括所选编程语言所需的导入语句。

6

Check the Include Driver Syntax option to include application code for the selected programming language. 选中“包含驱动程序语法”选项以包含所选编程语言的应用程序代码。If you include driver syntax, the copyable code reflects project, sort, maxtimems, collation, skip and limit options.如果包含驱动程序语法,可复制代码将反映投影排序maxtimems排序规则跳过限制选项。

7

Click at the top-right of the pipeline to copy the pipeline for the selected programming language to your clipboard. 单击管道右上角的,将所选编程语言的管道复制到剪贴板。You can now integrate and execute your created pipeline into your application.现在,您可以将创建的管道集成并执行到应用程序中。

8