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

Function onGetWinningDoc

lib/index.js:5950–5978  ·  view source on GitHub ↗
(winningDoc)

Source from the content-addressed store, hash-verified

5948 var winningRev$$1 = getWinningRev(metadata);
5949
5950 function onGetWinningDoc(winningDoc) {
5951
5952 var change = opts.processChange(winningDoc, metadata, opts);
5953 change.seq = metadata.seq;
5954
5955 var filtered = filter(change);
5956 if (typeof filtered === 'object') {
5957 return opts.complete(filtered);
5958 }
5959
5960 if (filtered) {
5961 called++;
5962
5963 if (opts.attachments && opts.include_docs) {
5964 // fetch attachment immediately for the benefit
5965 // of live listeners
5966 fetchAttachments([change], stores, opts).then(function () {
5967 opts.onChange(change);
5968 });
5969 } else {
5970 opts.onChange(change);
5971 }
5972
5973 if (opts.return_docs) {
5974 results.push(change);
5975 }
5976 }
5977 next();
5978 }
5979
5980 if (metadata.seq !== seq) {
5981 // 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…