Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-61780

UI: document viewer should retrieve documents in one API call

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Unresolved
    • Major
    • None
    • 7.2.0
    • UI
    • None
    • 0

    Description

      In the on-prem UI code, the document viewer retrieves documents using multiple API calls:

      • In the first call, it uses either the KV document API, or the query service to retrieve a list of document IDs
      • Subsequently, it retrieves each individual document using a separate REST call using the KV API.

      The reason for this was that, in the past, the `include_docs` argument in the KV REST API didn't work for retrieving more than one document at a time. This was later fixed, and should no longer restrict the UI code.

      The relevant code is in `query-ui/query-ui/angular-components/documents/qw.documents.component.js`.

      • On line 778, the query is formed as

      `select meta().id from...`.

      To retrieve the data as well, it should be:

      `select meta().id, <collection_name> as data from...`

      The result will contain the document id as the field `id`, and the document body as `data`.

      • On line 1088, the REST call has `include_docs=false`. Change that to `true` and the call will return document Ids and documents as well.
      • After the above calls, the subsequent call to `getDocsForIdArray` that was retrieving the individual documents will no longer be necessary. 

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Pramada.Kolichala Pramada Kolichala
            eben Eben Haber
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty