Uploaded image for project: 'Couchbase Java Client'
  1. Couchbase Java Client
  2. JCBC-247

ViewReponse: Provide a way to return the JSON as it is

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: .backlog1.x
    • Component/s: Core
    • Security Level: Public
    • Labels:
      None

      Description

      The Java API provide most of the time access to the JSON document (as string):

      • get commands
      • view command using the ViewRow.getDocument

      When we call a view the result is a ViewResponse, but it is not possible to get the JSON document out of it, and the view engine returned a JSON doc.

      It could be interesting for some development, to be able to do a viewResponse.toJSON() that returns the exact result of the view. (this function may not be compliant with the includesDoc(true) option)

      The use case is simple, suppose I am creating a REST API and I would like to call the view and return the result to the user it would be good to do something like :

      @GET
      @Produces(

      { "application/json"}

      )
      @Path("/person/")
      public String getPersons( )

      { View view = client.getView(PERSON_DSGN_DOC, PERSON_BY_NAME_VIEW); Query query = new Query(); ViewResponse viewResponse = client.query(view, query); return viewResponse.toJSON(); }

      Today I have to loop on each result and create a new object/document

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

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            daschl Michael Nitschinger
            Reporter:
            tgrall Tug Grall (Inactive)
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:

              Gerrit Reviews

              There are no open Gerrit changes