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

SDK3: Should return Mono<Optional> rather than Mono for get ops

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • 3.0.0-alpha.2
    • None
    • None
    • None
    • 1

    Description

      This tripped me up while doing txns porting.  Currently have Mono<GetResult> get("id"), which does Mono.empty() if the doc was not found. 

      This model is easy to get wrong.  Mono.empty raises no onNext, so it's very easy to write an app that simply gets no signal and does nothing if the doc is not found.

      The app can handle it with .defaultOnEmpty.  But it seems better to make this more explicit and harder to get wrong, and change Mono<GetResult> to Mono<Optional<GetResult>>.  This will apply to LookupIn too.

      Attachments

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

        Activity

          People

            graham.pople Graham Pople
            graham.pople Graham Pople
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty