Editing data in MongoDB
Modify data in the data editor
-
Open the MongoDB collection in the data editor.
-
Double-click the cell and modify a value.
Click the Preview Pending Changes icon (
) to see the DML.
Add a document to a collection
For MongoDB, adding a document to a collection is similar to adding a row to a relational table. The difference is that it is not mandatory for all the documents of a collection to have the same fields.
-
In the Database Explorer, double-click a MongoDB collection to open it in the data editor.
-
To add the draft of a document, right-click any area in the data editor and select Add Row. Alternatively, click the Add Row button (
) in the toolbar.
-
Change the values of fields from
<unset>to the required ones.If a specific field is not required in the new document, or must be generated upon the new document creation (for example, the values of
_idcolumn), leave it as<unset>. -
If you need to add the fields that are not currently present as columns in the new document, right-click any area in the data editor and select Add Column. Set the values of your new fields for the new document.
-
Click the Submit button (
) in the toolbar.
Delete a document from a collection
For MongoDB, deleting a document from a collection is similar to deleting a row from a relational table.
-
In the Database Explorer, double-click a MongoDB collection to open it in the data editor.
-
Select the document that you want to delete, right-click it and select Delete Row. Alternatively, click the Delete Row button (
) in the toolbar.
-
Click the Submit button (
) in the toolbar.
View and edit data in a separate editor
You can view and edit data and also raw JSON in a separate editor.
-
Right-click a cell in the collection opened in the data editor and select Open in Value Editor.
In the separate editor, you can wrap long values and change their types. To wrap a value, click Toggle Soft-Wrap. To change the type, click the type list and select the necessary value. Alternatively, to change a type, you can right-click a cell and select Change Type.
Add and delete columns
-
Right-click a header row of a column and select Add Column or Delete Column.