Docs Home / Compass / Create an Aggregation Pipeline

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

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步骤

1

Click Export to Language单击“导出到语言”

In the aggregation pipeline pane, click the Export to Language button to open the pipeline export card.在聚合管道窗格中,单击“导出到语言”按钮打开管道导出卡。

Aggregation Builder export button
2

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语法显示管道。右侧的导出管道窗格以所选编程语言显示管道。

3

(Optional) Include import statements(可选)包括导入语句

Click the Include Import Statements checkbox to include the required import statements for the selected programming language.单击“包含导入语句”复选框,以包含所选编程语言所需的导入语句。

4

(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.单击“包含驱动程序语法”复选框以包含所选编程语言的应用程序代码。如果包含驱动程序语法,可复制代码将反映投影排序最大时间排序规则跳过限制选项。

5

Click 点击图标

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

Learn More了解更多