Home » MongoDB » MongoDB Compass Insert Document Example

MongoDB Compass Insert Document Example

The following is an example to insert a document in MongoDB using Compass GUI tool.

Follow These Steps

  1. Open MongoDB Compass and connect to it.
  2. On the left side under My Cluster, select the database.
  3. Then select the collection in which you want to insert the document.
  4. Then on the right side click on the Insert Document button, as shown in the below image.
insert document example in mongodb compass
Compass GUI
  1. After that, an Insert Document window will pop up, and you will see an object id for the ID column will be showing already. Then you need to enter the field name and press TAB key to navigate to enter the VALUE for that field (no need to put a colon ":"), as shown in the below screenshot.
create Json data
Insert Document
  1. After competing entries for the document, click on the Insert button to save it.

This way you can insert a document in MongoDB using Compass GUI tool.

See also: