In this exercise, you’ll delete the document you created in the first exercise (the document whose last
field value is Grey
). To remove the document, you’ll use features available to the Collection Tab.
To delete the document
1. Open the “Grey” record and display it in Tree View if you did not leave it open from the previous exercise.
2. On the Result tab, select the row that contains the _id
field, and then click the Show remove dialog button () on the Result tab toolbar.
Studio 3T launches the Remove Documents dialog box and displays an expression that specifies the _id
field and the record’s unique identifier (the one associated with the “Grey” record), as shown in the following figure.
The code snippet defines the logic necessary to delete the “Grey” record, which in this case, is the selected document.
3. Click the Validate JSON button. You should receive a message saying that the query JSON is valid. Click OK to close the message box and return to the Remove Documents dialog box.
4. Click Remove. You should receive a message stating that one document has been removed. Click OK to close the message box.
5. If the Query text box still includes the expression you specified in Exercise 2, delete the expression and click the Run query button () to the right of the Query text box.
6. At the bottom of the Result tab, click the Count Document button. The customers collection should now contain only the original 1,000 documents.
7. Close the customers collection tab, but do not drop the collection or database. You will need them for the rest of this course.
8. Close Studio 3T.