Autocomplete
On this page
The MongoDB for IntelliJ Plugin provides autocomplete suggestions for database, collection, or field names based on the connected data source. For example, when you start typing a field name in a query, the plugin analyzes the MongoDB collection and document schema to automatically suggest valid field names.
To use the autocomplete feature, start typing in a document field, collection,
or database name. Then press Ctrl
+ Space
to display a drop-down
list that shows the available suggestions.
Database Name Autocompletion
To autocomplete database names, press Ctrl
+ Space
inside the getDatabase()
method of a MongoClient
instance.
The IntelliJ Plugin displays a drop-down list of available database names,
denoted by the MongoDB Database
text and the database icon, as shown in
the following image:
Collection Name Autocompletion
To autocomplete collection names, press Ctrl
+ Space
inside the getCollection()
method of a MongoClient
instance.
The IntelliJ Plugin displays a drop-down list of available collection names,
denoted by the MongoDB Collection
text and the collection icon, as shown in
the following image:
Important
Collection name autocompletion currently requires a complete query to suggest collection names. For example, you must write a query that specifies the database name and a document field for the IntelliJ Plugin to suggest valid collection names.
Document Field Name Autocompletion
To autocomplete document field names, press Ctrl
+ Space
inside one of the following MongoCollection
methods:
countDocuments
deleteMany
deleteOne
distinct
find
findOneAndDelete
findOneAndReplace
findOneAndUpdate
replaceOne
updateMany
updateOne
The IntelliJ Plugin displays a drop-down list of available field names,
denoted by their data type and the document icon. For example, the following
image shows autocomplete suggestions for fields that start with rat
in the
sample_mflix.movies
collection: