That's a great idea Jens!

Thanks!

Brendan

On Tuesday, July 14, 2015 at 10:07:31 AM UTC-6, Jens Alfke wrote:
>
>
> On Jul 14, 2015, at 2:47 AM, Brendan Duddridge <[email protected] 
> <javascript:>> wrote:
>
> If I want to update a CBLView, is it better to adjust the map block's 
> version number or just delete and re-create the view? The view will be user 
> generated based on parameters, so I'm thinking it's just easier to delete 
> the view and re-create it.
>
>
> It’s slightly less efficient to re-create the view, because it involves 
> dropping and re-creating SQLite tables (or ForestDB key/value stores.) But 
> I don’t think the difference is noticeable.
>
> You might consider doing what the CBLQueryBuilder does: it takes the 
> parameters that affect the map function and generates a unique digest from 
> them (by putting them in an NSDictionary, converting to canonical JSON, 
> then taking the SHA-1 of the JSON data.) You can use that digest as the 
> view’s version string. The advantage of this is that it’ll automatically 
> invalidate the index if the parameters change, without your having to keep 
> track of what the old parameter values were.
>
> —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/27ee1f3e-6bc5-4cf7-ab54-0ea328a13f77%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to