I have a
View with a
Map function and I want to be sure it doesn’t return duplicates. For this I based my solution on the solution provided by this StackOverflow post. This add a
reduce function to the original map.
But I also want to get the size of the final result. For this I 've written a simple reduce function:
if (rereduce) return com.couchbase.lite.View.totalValues(values); else return values.size();
But how do I combine both reduce functions? I want to be able to query the view with only the first reduce function (filtering) or with both (filtering + counting). I’m pretty sure the
rereduce parameter may help on this but I’m not sure to fully understand its behavior.
(I’m using CBL Android 1.x)