Export Pipeline to Specific Language将管道导出为特定语言
New in version 1.15.01.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. This feature facilitates formatting and exporting pipelines created in MongoDB Compass for use in your applications.您可以使用聚合管道生成器将完成的管道导出为支持的语言之一;Java、Node、C#和Python 3。此功能便于格式化和导出在MongoDB Compass中创建的管道,以便在应用程序中使用。
Procedure过程
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中创建聚合管道的说明,请参阅聚合管道生成器。
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 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.如果包含驱动程序语法,则可复制代码会反映project、sort、maxtimems、collation、skip和limit选项。