MCPcopy
hub / github.com/apache/pouchdb / onGetWinningDoc

Function onGetWinningDoc

lib/index.es.js:5945–5973  ·  view source on GitHub ↗
(winningDoc)

Source from the content-addressed store, hash-verified

5943 var winningRev$$1 = getWinningRev(metadata);
5944
5945 function onGetWinningDoc(winningDoc) {
5946
5947 var change = opts.processChange(winningDoc, metadata, opts);
5948 change.seq = metadata.seq;
5949
5950 var filtered = filter(change);
5951 if (typeof filtered === 'object') {
5952 return opts.complete(filtered);
5953 }
5954
5955 if (filtered) {
5956 called++;
5957
5958 if (opts.attachments && opts.include_docs) {
5959 // fetch attachment immediately for the benefit
5960 // of live listeners
5961 fetchAttachments([change], stores, opts).then(function () {
5962 opts.onChange(change);
5963 });
5964 } else {
5965 opts.onChange(change);
5966 }
5967
5968 if (opts.return_docs) {
5969 results.push(change);
5970 }
5971 }
5972 next();
5973 }
5974
5975 if (metadata.seq !== seq) {
5976 // some other seq is later

Callers 1

onGetMetadataFunction · 0.70

Calls 4

filterFunction · 0.70
fetchAttachmentsFunction · 0.70
nextFunction · 0.70
onChangeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…