Navigation

Modify Documents

Select the appropriate tab based on whether you are viewing your documents in List or Table view:

To modify a document, hover over the document and click the pencil icon:

../../_images/edit-doc.png

To modify a document, hover over the document and click the pencil icon:

../../_images/table-view-modify.png

After you click the pencil icon, the document enters edit mode:

../../_images/edit-doc2.png

You can now make changes to the fields, values, or data types of values.

Tip

For the field values, you can paste valid JSON that can be parsed by JavaScript’s JSON.parse.

  • If the pasted JSON is an Array, the first character must be a left bracket [ and the last character must be a right bracket ]:

    [ "first", "second", 3 ]
    
  • If the pasted JSON is an Object (i.e. a document), the keys must be quoted in double quotes and are permitted to be escaped. The first character must be left curly brace { and the last must be right curly brace }:

    {
      "email": "test@example.com",
      "phone": "555-555-1212"
    }
    

Delete Fields

You can delete fields by selecting the x icon to the left of the field:

../../_images/edit-doc3.png

Once selected, the field is marked for removal and appears highlighted in red:

../../_images/edit-doc4.png

Add New Fields

To insert a new field, click or tab to the end of the document and fill in the field/value. New fields appear highlighted in green:

../../_images/edit-doc5.png

To add a new field for the document, hover over the row number in the dialog (the row number is not part of the document but the dialog display) and click on the plus sign add a new field after the field.

You can also add a new field at the end by clicking the Tab from the value of the last field.

Tip

To add a new field after an array or a document field, hover over the row number in the dialog (the row number is not part of the document but the dialog display) and click on the plus sign add a new field after the field.

Modify an Existing Field

You can modify documents by clicking on existing field names or values and making changes. In this example, the flight status was changed from L to M. Changed fields appear highlighted in yellow:

../../_images/update-field.png

When you are finished editing the document, click the Update button to commit your changes. Compass performs a findAndModify operation to update the document.

Revert a Change

While modifying a document, you have the option to revert changes made to a field prior to saving the modified document.

To revert changes to a document in the List View, hover over the edited field and click the revert icon which appears to the left of the field’s line number.

../../_images/revert-doc-list-view.png

To revert changes to a document in the Table View, click the revert icon which appears on the right side of the edited table element.

../../_images/revert-doc-table-view.png

Cancel Changes

To exit the edit mode and cancel all pending changes to the document, click the Cancel button.