General Couchbase view questions

When creating a view, if the document type check only accesses the metadata document key and not any fields of the document itself (ex., if substring (metatdata_key, 1, 5) == 'MYDOC" instead of if doc_type == ‘MYDOC’), would it make view creation faster because it won’t have to read the actual documents (perhaps, with the exception of MYDOC type).

I thought that the map function is applied to all documents in the bucket and therefore this suggestion has no merit, but I don’t know for sure. Is there a good way to test it?

Thank you,
– Alex

1 Like

Not sure we have any optim in the Map function when you are not using the doc object. It is still passed to the function anyway. I guess we should ask @steve.

@steve, can you please comment whether Couchbase actually implements a lazy read on the document and if only metadata information is used in a view, the document won’t be physically read during view creation?

Thank you,
– Alex