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

Function processMetadataAndWinningDoc

lib/index-browser.js:5715–5744  ·  view source on GitHub ↗
(metadata, winningDoc)

Source from the content-addressed store, hash-verified

5713 var metadatas = new Array(batchKeys.length);
5714
5715 function processMetadataAndWinningDoc(metadata, winningDoc) {
5716 var change = opts.processChange(winningDoc, metadata, opts);
5717 lastSeq = change.seq = metadata.seq;
5718
5719 var filtered = filter(change);
5720 if (typeof filtered === 'object') { // anything but true/false indicates error
5721 return Promise.reject(filtered);
5722 }
5723
5724 if (!filtered) {
5725 return Promise.resolve();
5726 }
5727 numResults++;
5728 if (opts.return_docs) {
5729 results.push(change);
5730 }
5731 // process the attachment immediately
5732 // for the benefit of live listeners
5733 if (opts.attachments && opts.include_docs) {
5734 return new Promise(function (resolve) {
5735 fetchAttachmentsIfNecessary(winningDoc, opts, txn, function () {
5736 postProcessAttachments([change], opts.binary).then(function () {
5737 resolve(change);
5738 });
5739 });
5740 });
5741 } else {
5742 return Promise.resolve(change);
5743 }
5744 }
5745
5746 function onBatchDone() {
5747 var promises = [];

Callers 1

onBatchDoneFunction · 0.70

Calls 3

filterFunction · 0.70
postProcessAttachmentsFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…