Skip to Main Content

MongoByte MongoDB Logo

Welcome to the new MongoDB Feedback Portal!

{Improvement: "Your idea"}
We’ve upgraded our system to better capture and act on your feedback.
Your feedback is meaningful and helps us build better products.

Status Completed
Categories IDEs
Created by Guest
Created on Jan 8, 2021

Formatting support for mongodb playground files.

There's no way that I can find to format the code in a .mongodb playground file. At present, I need to manually change the file suffix to js, then use a hot-key to run prettier, then rename it back. If there is a better way, I'd love to know it! Thanks, Kim
  • ADMIN RESPONSE
    Oct 18, 2025
    With MongoDB for VS Code 1.0, Playground files are now true JS files. This means that whatever configuration you normally use for code formatting (e.g. Standard, Prettier, etc.) is available also for Playgrounds.
  • Guest
    Oct 28, 2021
    Suggestion: 1. Could please make "mongodb" as subtype of "javascript" so that did does not break the playground feature, and at the same time get all the features associated with javascript. (https://github.com/mongodb-js/vscode/issues/122#issuecomment-679909456) 2. You could support any formatter with following "[mongodb]": { "editor.defaultFormatter": "vscode.typescript-language-features" },
  • Guest
    Jan 8, 2021
    Thanks for the tip @Massimiliano. I think most folks are working with Prettier these days. It might be best to try to look in that direction.
  • Guest
    Jan 8, 2021
    Right now we don't have a built-in formatter. However, there is a workaround: with the beautify extension (https://marketplace.visualstudio.com/items?itemName=HookyQR.beautify) you can format the file without changing the file extension (Cmd/Ctrl + Shift + P > Beautify file > JS).