1. Knowledge Base
  2. Studio 3T Tutorials
  3. How to Insert MongoDB Documents

How to Insert MongoDB Documents

Studio 3T makes it straightforward to insert MongoDB documents to a collection while viewing it in Table, Tree, or JSON View.

  1. Connect to your MongoDB database.
  2. Choose the collection from the Connection Tree.
  3. Right-click on any cell and choose Insert Document.
    Alternatively, use the hotkey Ctrl + D (⌘ + D).Right-click on any cell to insert a documentThis will open the Insert Document > JSON window.
  4. Type the fields to be added in JSON format. There is no need to add an _id field, as mongod will create this and assign the document a unique ObjectId value.Insert JSON document to be added

    Click on Validate JSON to ensure everything is correct before adding the document.

  5. Click on Add Document, or Add & Continue if adding more documents. The new document should then appear in the collection’s Result tab.The newly added document will then appear in the Result Tab
Updated on April 5, 2019

Was this article helpful?

Related Articles


    1. Hello and thanks for reaching out!

      Per MongoDB’s documentation, if you’re inserting a document that doesn’t specify the _id field, MongoDB creates it automatically. If you’re inserting a document that specifies the _id field, it must be unique within the collection to avoid duplicate key error: https://docs.mongodb.com/manual/reference/method/db.collection.insert/

      Hope this helps,

Leave a Comment