> On Jul 14, 2015, at 2:47 AM, Brendan Duddridge <[email protected]> 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/5DF76474-6C2F-428F-8679-228A78B9FD4F%40couchbase.com. For more options, visit https://groups.google.com/d/optout.
