Manage Documents

    +
    The Couchbase Cloud UI provides a document inspector that can be used to view and edit bucket documents.

    Accessing Documents in the Couchbase Cloud UI

    Documents can be viewed and managed under each cluster’s Tools > Documents tab.

    A cluster’s 'Tools > Documents' tab, showing a table of document results from the 'beer-sample' bucket.
    Database Permissions Required

    In order to access documents in the Couchbase Cloud UI, you must have a database user associated with your organization user account. Without a database user, the Tools > Documents tab will display a message saying that you don’t have the proper permissions to access documents.

    The database user must be configured to have permissions for the particular buckets that contain the documents that you wish to access. To view the documents in a particular bucket, your database user must have Read permissions for the bucket. To view and edit the documents in a particular bucket, your database user must have Read/Write permissions for the bucket.

    Retrieve Documents

    The Tools > Documents tab allows you to retrieve and view the individual documents that are contained within a bucket on the cluster. The retrieved documents are summarized in table format, with a row for each retrieved document. Document retrieval controls are provided at the top of the summary, which you can use to control which documents are retrieved and displayed in the summary.

    The following controls are provided:

    • Bucket: A drop-down menu that displays the name of the bucket whose documents are currently being viewed. You can use the drop-down menu to select from a list of buckets that your associated database user has access to.

    • Limit: The maximum number of rows (documents) to retrieve and display at once.

    • Offset: The number of documents in the entire set of the current bucket that should be skipped, before display begins.

    • Document ID: Accepts the ID of a specific document. Leave this field blank to retrieve documents based on Limit and Offset.

    • N1QL WHERE: Accepts a N1QL query — specifically a WHERE clause — which determines the subset of documents to be displayed.

      This field is only enabled if the Query Service is running on the cluster.

    After configuring any of the above controls, click Retrieve Docs to retrieve a new set of documents based on your configurations. Under Results, each document is represented by an individual row that contains the document’s ID and Content Summary.

    View and Edit Existing Documents

    After retrieving a set of documents, clicking on a row in the Results section opens the document in the Document fly-out menu, which allows you to make direct edits to the document.

    The document displays in the JSON tab, and consists of a series of key-value pairs (or, as they are sometimes expressed, name-value pairs). You can make modifications to key-values directly in the JSON editor. Click Save to save your changes.

    You can view the document’s metadata by clicking on the Meta tab. Couchbase generates metadata in association with each document when the document is saved, and thus can’t be directly edited. (Read more about document metadata.)

    Add and Delete Documents

    If you want to create an entirely new document, you can click Add Document. This opens the Document fly-out menu, which has a field for entering the Document ID, as well as an editor for entering the contents of the document. Click Save to create the document.

    To delete a document, start by retrieving the desired document so that it appears in the Results section. Then click the Trash icon at the end of the row on the right side, and when prompted to confirm the deletion, click Confirm.