Manage Documents

    +
    The Couchbase Capella UI provides a document editor that you can use to view and edit documents.

    This page describes how you can interact with and manage documents in a Couchbase cluster using the Capella UI.

    Permissions Required

    To use the document editor in the Capella UI, you need the appropriate project role.

    • To view the documents within a cluster, you must have the Cluster Data Reader project role for the project containing the cluster.

    • To view, add, edit, and delete documents in a cluster, you must have the Cluster Data Reader/Writer project role for the project containing the cluster.

    Accessing Documents in the Capella 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.

    Retrieve Documents

    • Couchbase 7.0+

    • Couchbase 6.6

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

    The following controls are available:

    • Bucket: A drop-down menu that displays the name of the bucket whose documents are shown. You can use the drop-down menu to select from a list of buckets in the current cluster.

    • Scope: A drop-down menu that displays the name of the scope whose documents are currently shown. The _default scope is selected by default. You can use the drop-down menu to select from a list of all the scopes within the current bucket.

    • Collection: A drop-down menu that displays the name of the collection whose documents are currently shown. The _default collection is selected by default. You can use the drop-down menu to select from a list of all the collections within the current scope.

    • 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.

    When you use the Bucket, Scope, or Collections controls, the set of documents is automatically updated based on your selections. After using the Limit, Offset, Document ID, or N1QL WHERE controls, you must click Retrieve Docs to retrieve a new set of documents based on your new configuration.

    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 a 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 available:

    • 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 in the current cluster.

    • 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.

    View and Edit Existing Documents

    After retrieving a set of documents, clicking on a document name in the results area opens that document in the Document fly-out menu. This fly-out menu allows you to view and edit the document directly.

    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 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, so you can’t edit it directly. (Read more about document metadata.)

    Add and Delete Documents

    If you want to create a 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 area. Then click the Trash icon at the end of the row on the right side.

    To import a set of JSON documents or a CSV file, see the Import page.