Skip to content

MongocampVersionConflict ​

The merge dialog of a version conflict (server 2.3, a versioned declared collection): someone saved the document while it was being edited. Presentational — the parent computes the merge and saves. MongocampCollectionData opens it on a 409 of an edit.

vue
<MongocampVersionConflict
  v-model:open="open"
  :stored="current"
  :merged="applyChanges(current, rebase.changes)"
  :conflicts="rebase.conflicts"
  :saving="saving"
  :error="error"
  @apply="saveAgain"
  @discard="reload"
/>
PropDescription
storedThe document as it is stored now (the 409's current; canonical when the write asked extendedJson: 'canonical', as MongocampCollectionData does)
mergedThe stored document with the user's changes applied — what Apply will store
conflictsPaths both sides changed; applying keeps the user's value there
savingApply is running: buttons disabled, the dialog cannot be dismissed
errorA failure of the last apply, shown in the dialog
v-model:openOpen state; Keep editing closes only this dialog

Emits apply and discard. The body is a summary (the overlapping fields, or "your changes do not touch what they changed") and a MongocampDocumentCompare of stored and merged, only differences by default.

Pure part: utils/versionConflict.ts — rebaseChanges(original, mine, current, declaration) → { changes, conflicts, theirs } (server-owned fields are never a conflict; an Extended JSON form difference such as { $numberInt: '1' } vs 1 is no change) and applyChanges(document, changes).

Root class mongocamp-version-conflict (on the dialog content).

Released under the MIT License.