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

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Won't Do
    • Minor
    • None
    • None
    • Core
    • Security Level: Public
    • 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

      Attachments

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

        Activity

          People

            daschl Michael Nitschinger
            tgrall Tug Grall (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty