MongocampDocumentCompare
Two documents side by side, compared path by path.
<MongocampDocumentCompare :left="docA" :right="docB" left-label="v1" right-label="v2" v-model:only-differences="onlyDiff" />| Prop | Description |
|---|---|
left, right | The two documents (plain, or with extended-JSON wrappers) |
leftLabel, rightLabel | Column headers (default "Left"/"Right") |
v-model:onlyDifferences | Hide the paths both documents agree on (default false) |
Each path gets a text label (same / changed / added / removed) as well as a colour, plus a count summary. A leaf with the same value but another stored type (1 vs "1", a { $date } vs date-like text { $string }, an { $oid } vs an id string) is changed and shows both types — server 2.0 always wraps ids, dates and date-like text, so such a pair is a real difference. Two dates are compared as instants (another zone or .000 is same). With documents read typed (extendedJson=canonical, as the data table's Compare does) two exact numeric types also differ: an int 5 and a long 5, or a double and a decimal with the same text; a plain number next to an exact wrapper still does not. Key order is not a difference. Very large documents are cut at the path limit and say so.
In the data table
MongocampCollectionData shows Compare selected in the selection bar when exactly two rows on screen are ticked; it opens this component in a dialog, headed by the two _ids.
Pure part: utils/documentCompare.ts (compareDocuments, compareText, plainValue) over flattenDocument.