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中创建的管道,以便在应用程序中使用。
Procedure过程¶
Open the Aggregation Pipeline Builder for the desired collection.打开所需集合的聚合管道生成器。¶
Navigate to the collection for which you wish to export your aggregation pipeline. 导航到要为其导出聚合管道的集合。Click the Aggregations tab.单击“聚合”选项卡。
Create a new pipeline or open an existing one.创建新管道或打开现有管道。¶
For instructions on creating an aggregation pipeline in MongoDB Compass, see Aggregation Pipeline Builder.有关在MongoDB Compass中创建聚合管道的说明,请参阅聚合管道生成器。
Click the Export button.单击“导出”按钮。¶
Select your desired export language.选择所需的导出语言。¶
In the Export Pipeline To: dropdown, select your desired programming language:在“导出管道到:”下拉列表中,选择所需的编程语言:
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.右侧的窗格以所选编程语言显示管道。
Optional: Include import statements, if desired.可选:如果需要,包括导入语句。¶
Check the Include Import Statements option to include the required import statements for the selected programming language.选中“包括导入语句”选项以包括所选编程语言所需的导入语句。
Optional: Include driver syntax, if desired.可选:如果需要,包括驱动程序语法。¶
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、排序规则、跳过和限制选项。
Click .点击。¶
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.现在,您可以将创建的管道集成并执行到应用程序中。