Navigation

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#, and Python 3. This feature facilitates reformatting and utilizing queries created in MongoDB Compass for use in your application.

Procedure

  1. After constructing a query in the query bar, click the button to the right of the Reset button.

  2. Select Export to Language:

    Query bar export dropdown
  3. In the Export Query To: dropdown, select your desired language:

    Query bar language select

    The My Query pane on the left displays your query in mongo shell syntax.

    The pane to the right displays your query in the language selected.

  4. (Optional): Check the Include Import Statements option to include the required import statements for the language selected.

  5. Click the Copy button 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.

  6. Click Close to return to the Documents Tab.

←   Query Bar Documents  →