Emitting whole doc

In lots of places i’ve read that u should not emit whole doc in view for example

emit(doc.email, doc)

and to instead use include_docs=true, but then i come across this
"The only way to ensure full consistency here is to include the documents themselves in the values emitted by the map function."
So, what’s true?

if you look at the example you will see that stale is set to stale=update_after not stale=false.
I would suggest doing stale=false&include_docs=false… and loop through the keys via SDK with get() or multiget().


As you can see in the documentation chapter you are pointing, this is a “debug chapter”, this means this is here to help your understand behavior when things are not working as expected.

The best practise is really: do not emit the document!

If you do that, all your database will be copy in the index, wasting lot of place for almost no benefits.

it is better to emit the key you need, some value of needed, and then use the document ID from your application to get the full document. You may have some kind of inconsistency but this is most of the time a corner case, since you can control this with the “durability constraints” (PersistTo.Master) and query stale option (stale=false)