> On Feb 8, 2016, at 4:25 AM, Prasanna Kumar Peddinti 
> <[email protected]> wrote:
> 
> 1) Is this best way to do the thinks, like making reindex views again and 
> again when user role is changed.

No. Generally you shouldn’t be changing the map function of the view based on 
query parameters. The role of the map function is to generate an index, and you 
want the index to be useable for all queries on this view. Any time you change 
the map function, the index is wiped out, so you’re losing the benefit of the 
index.

I don’t have time to review your code or design in depth (not unless you want 
to pay us for consulting ;) but it looks like your map function only has two 
cases: one where userRole==0 and one otherwise. So just make it into two views, 
one for each case.

—Jens

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/5E35BB8C-FCC8-4FFF-96C4-6DD7895C4F8E%40couchbase.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to