Docs Menu
Docs Home
/
MongoDB for VS Code
/

/schema Command

On this page

  • Example

The /schema command provides information about your collection schema by accessing your connected MongoDB deployment.

This example uses the users collection in the Mflix Sample Database. Each document in the collection has the following structure:

{
_id: {
"$oid": "59b99db4cfa9a34dcd7885b6"
},
name: "Ned Stark",
email: "sean_bean@gameofthron.es",
password: "$2b$12$UREFwsRUoyF0CRqGNK0LzO0HM/jLhgUCNNIJ9RJAqMUQ74crlJ1Vu"
}

If you are connected to a MongoDB deployment that contains this collection, you can ask the MongoDB Extension for Github Copilot to show the schema of your collection:

@MongoDB /schema Can you show the schema for the sample_mflix.users
collection?

GitHub Copilot uses the MongoDB Extension for Github Copilot to generate the following response:

Screenshot of copilot generated a schema description
click to enlarge

After Copilot generates the response, you can open the output in JSON format.

Back

/query

On this page