Try Studio 3T for Free

How to Insert MongoDB Documents to a Collection

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 May 27, 2019

Was this article helpful?

Related Articles

Comments

  1. Hi.

    So I copy a record, edit the json and insert it again. All Int32 and Int64 are being converted to Double with (.0) decimals. Is there a way for this not to happen? It’s super tedious when editing many values. Also, is there a way to keep the column order, which is shuffling all the time. This makes it very tedious to review and compare data. Both of these issues could be addressed with some sort of light weight schema for editing purposes I suppose.

    Thanks

Leave a Comment