I have list of document ids for which I am doing bulk read using Observable using below code which returns a list of documents found:
I have to add 2 requirements here:
If there is no document available in couchbase for any key, then I need to retry read operation again by changing the key(using Like operation with truncated key).
If there is no document found after all retries then I need that key for further processing.
So after processing I should get list of documents found and list of keys for which document is missing.
I am not sure if it can be achieved using N1QL/View/Observables. Plz give me some pointers on how it can be achieved?
@ldoguin Since we are using JDK 1.6 in our application I can not use Lambada expressions. But I am stuck at filter operator. As per my understanding we can have one input and one output for every function in flatmap. But in filter you are using 2 inputs i.e. doc and id and output is Boolean. Can you plz let me know how can I get the handle of document in Filter operator.
@ldoguin, Can you plz also confirms that operators switchIfEmpty, defaultIfEmpty and filter will be inside flatMap? And I am getting beloww error in switchIfEmpty:
switchIfEmpty takes an object, not a function, so you can put dsBucket.async().get(retryGetWithNewKey(id)) directly.
and yes they are all inside the flatMap as you need to keep a reference to the id.