MCPcopy Index your code
hub / github.com/apache/pouchdb / writeDoc

Function writeDoc

lib/index-browser.js:5121–5147  ·  view source on GitHub ↗
(docInfo, winningRev$$1, winningRevIsDeleted, newRevIsDeleted,
                    isUpdate, delta, resultsIdx, callback)

Source from the content-addressed store, hash-verified

5119 }
5120
5121 function writeDoc(docInfo, winningRev$$1, winningRevIsDeleted, newRevIsDeleted,
5122 isUpdate, delta, resultsIdx, callback) {
5123
5124 docInfo.metadata.winningRev = winningRev$$1;
5125 docInfo.metadata.deleted = winningRevIsDeleted;
5126
5127 var doc = docInfo.data;
5128 doc._id = docInfo.metadata.id;
5129 doc._rev = docInfo.metadata.rev;
5130
5131 if (newRevIsDeleted) {
5132 doc._deleted = true;
5133 }
5134
5135 var hasAttachments = doc._attachments &&
5136 Object.keys(doc._attachments).length;
5137 if (hasAttachments) {
5138 return writeAttachments(docInfo, winningRev$$1, winningRevIsDeleted,
5139 isUpdate, resultsIdx, callback);
5140 }
5141
5142 docCountDelta += delta;
5143 updateDocCountIfReady();
5144
5145 finishDoc(docInfo, winningRev$$1, winningRevIsDeleted,
5146 isUpdate, resultsIdx, callback);
5147 }
5148
5149 function finishDoc(docInfo, winningRev$$1, winningRevIsDeleted,
5150 isUpdate, resultsIdx, callback) {

Callers 2

updateDocFunction · 0.70
insertDocFunction · 0.70

Calls 3

writeAttachmentsFunction · 0.70
updateDocCountIfReadyFunction · 0.70
finishDocFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…