RavenDB 2.x  Beginner's Guide
上QQ阅读APP看书,第一时间看更新

Time for action – modifying a document

You will explore and learn to modify a document displayed within the Management Studio's Collections screen.

  1. In the Management Studio, select the Collections tab to display the Collections screen.

    In the Collections screen section, we can see that we have one collection named Orders which contains five documents.

    Under the Documents screen section, we see all documents related to the Orders collection which is the active selection in the Collections section.

  2. Choose the ID Only view mode to display only the ID of each document in the Documents screen section. (The Switch between views button is located on the top-right corner of the Documents screen section).
    Note

    There are six different view modes we can switch between: Details, ID Only, Small Card, Medium Card, Large Card, and Extra Large Card.

  3. Select the document with the ID = Orders/B768920 from the Documents screen section and click on the pencil icon on the bottom-right corner to open it in the edit mode.
  4. Modify the selected document directly by changing the value of the UnitCost field to 1.99 and then click on the Save button to save the modified document.

What just happened?

We used the Collections screen to load the document with the ID = Orders/B768920 in the edit mode screen and modified its UnitCost field value.

Note

When modifying a document be sure that the JSON structure is still valid otherwise you will get an error which will be displayed in the Errors screen section.