Export Query to Specific Language
New in version 1.15.0
You can export queries created in the query bar to one of the supported languages; Java, Node, C#, Python 3, Ruby, Go, Rust, and PHP. This feature allows you to reformat and use MongoDB Compass queries in your application.
After constructing a query in the query bar, click to the right of the Reset button.
Click the Export to Language button
In the Export Query To: dropdown, select your desired language:
The My Query pane on the left displays your query in
The pane to the right displays your query in the language selected.
(Optional): Check the Include Import Statements option to include the required import statements for the language selected.
(Optional): Check the Include Driver Syntax option to include application code for the language selected. If you include driver syntax, the copyable code reflects project, sort, maxtimems, collation, skip and limit options.
Click at the top-right of the formatted query to copy the query for the selected language to your clipboard. You can now easily integrate and execute your created query in your application.
Click Close to return to the Documents Tab.