MongoDB for VS Code: Difference between revisions

From Bitpost wiki
No edit summary
No edit summary
 
Line 7: Line 7:
  db.getCollection('my-collection').find()
  db.getCollection('my-collection').find()
* Save it, and then use Ctrl-P and start typing "playground" to re-open it
* Save it, and then use Ctrl-P and start typing "playground" to re-open it
* Ctrl-J to edit key commands, search for "Playground", set all three commands to fire on Ctrl-Enter in md
* Ctl-Sh-J to edit key commands, search for "Playground", set all three commands to fire on Ctrl-Enter in md

Latest revision as of 15:38, 23 August 2023

This is a powerful extension from the MongoDB devs, but it is tricky to get up to speed.

Setup

  • Install MongoDB for VS Code extension
  • Create a "playground" folder somewhere (it can find them in your project workspace but to me that's messy)
  • Open a playground and prime it with something like this:
use('my-db');
db.getCollection('my-collection').find()
  • Save it, and then use Ctrl-P and start typing "playground" to re-open it
  • Ctl-Sh-J to edit key commands, search for "Playground", set all three commands to fire on Ctrl-Enter in md