How to get viewRow.document() with java SDK 3.x

Dear sir,
could you give an example for this to fetch document from View in couchbase java sdk3+.
I could not find any such example?

I could not find code for how to migrate ViewRow.document() method from java sdk1.2 to sdk3+.

if you could give me coding example than would be great.

I am getting ViewResult from asyncBucket.

MY code:

CompletableFutureresult=bucket.viewQuery(getDesignDoc(), getView(),viewOptions);

result.get().rows().stream().collect(Collector.ToList())

;//here i want to collect document from the View.

if you code give me code example than would be great.

An IDE (like Intellij) will help immensely with this.

    CompletableFuture<ViewResult> result=bucket.viewQuery(getDesignDoc(), getView(),viewOptions);

    List<ViewRow> myList=result.get().rows();
    
    for(ViewRow row:myList){
      YourClass doc = row.valueAs(YourClass.class);
    }
1 Like

My class is Person class having 3 attributes aslike below.
YourClass.class=>Person.class
Class person:
private string name;
Private int age;
private boolean gender;

So will this work?

One more question, when to use valueAs vs keyAs

One last question , how wrap the above call to io.reactorproject asynchronous processing…

Could help with one example…like we have

Rx observable.defer ()???

The documentation and examples is a good place to start.

Thank you sir :pray: it helped

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.