Enable Autocomplete for String Literals
On this page
You can optionally enable autocomplete for string literals
inside VSCode. Enabling autocomplete for string literals lets you
automatically populate database and collection names when using
use("")
or db.getCollection("")
syntax within a MongoDB
playground.
About this Task
Enabling autocomplete for string literals is a global VSCode setting. Changing this setting may affect the behavior and performance of other extensions and of VSCode itself.
If you do not want to enable autocomplete for string literals inside VSCode, you can use the keyboard shortcut
Ctrl
+Space
. This shortcut prompts autocomplete for string literals in your MongoDB playground.
Before you Begin
Install the MongoDB VSCode extension.
Steps
Test the autocompletion feature
In a new playground file connected to your deployment,
type the first character of a collection name between
db.getCollection("")
and click the full name to populate
the collection name:
You can also autocomplete database names by typing the first
character of a database name in-between the use("")
statement.