Including documents in the emit compared to include_docs = true in CouchDB

后端 未结 2 1508
后悔当初
后悔当初 2020-12-31 03:07

I ran across a mention somewhere that doing an emit(key, doc) will increase the amount of time an index takes to build (or something to that effect).

Is

2条回答
  •  旧时难觅i
    2020-12-31 03:39

    Yes, it will increase the size of your index, because CouchDB effectively copies the entire document in those cases. For cases in which you can, use include_docs=true.

    There is, however, a race condition to be aware of when using this that is mentioned in the wiki. It is possible, during the time between reading the view data and fetching the document, that said document has changed (or has been deleted, in which case _deleted will be true). This is documented here under "Querying Options".

提交回复
热议问题