You can use the Aggregation Pipeline Builder to format and export finished pipelines. You can export pipelines to a chosen language to use in your application.您可以使用聚合管道生成器来格式化和导出已完成的管道。您可以将管道导出为所选语言,以便在应用程序中使用。
About this Task关于此任务
You can export your pipeline to the following languages:您可以将管道导出为以下语言:
- C#
- Go
- Java
- Node
- PHP
- Python
- Ruby
- Rust
Steps步骤
Click Export to Language单击“导出到语言”
In the aggregation pipeline pane, click the Export to Language button to open the pipeline export card.在聚合管道窗格中,单击“导出到语言”按钮打开管道导出卡。

Select your export language选择导出语言
On the right side of the card, click the drop-down menu under Exported Pipeline and select your desired programming language.在卡的右侧,单击“导出管道”下的下拉菜单,然后选择所需的编程语言。
The My Pipeline pane on the left of the export card displays your pipeline in 导出卡左侧的“我的管道”窗格以mongosh syntax. The Exported Pipeline pane to the right displays your pipeline in the selected programming language.mongosh语法显示管道。右侧的导出管道窗格以所选编程语言显示管道。
(Optional) Include import statements(可选)包括导入语句
Click the Include Import Statements checkbox to include the required import statements for the selected programming language.单击“包含导入语句”复选框,以包含所选编程语言所需的导入语句。
(Optional) Include driver syntax(可选)包括驱动程序语法
Click the Include Driver Syntax checkbox 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.单击“包含驱动程序语法”复选框以包含所选编程语言的应用程序代码。如果包含驱动程序语法,可复制代码将反映投影、排序、最大时间、排序规则、跳过和限制选项。