You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
#grid Document View: first Add save should insert, not upsert #rdg #1153
Copilot C5 reported that a first Add save can reach upsertDocument with _id: 0, false, "", or null, and that replaceOne(..., { upsert: true }) can silently overwrite a matching document.
The silent-overwrite behavior is already present on main for every truthy supplied _id: the Add save routes the supplied ID to replaceOne(..., { upsert: true }), so a matching existing document is overwritten. The old truthy check dropped the four falsy IDs instead of saving them; #1142 fixes that handling. The existing fix commit is 8cc23e1563bd2fedbb07514c3a8eb788c5c14b38. It consequently adds those four newly recognized falsy IDs to the pre-existing overwrite behavior while also fixing the higher-severity Edit-mode duplicate bug for falsy IDs.
Route an explicit isNew value through the first Add-save path:
A first Add save calls a new ClustersClient.insertDocument method using insertOne, rather than upsertDocument.
A duplicate-key E11000 error is surfaced to the user and no stored document is altered.
Subsequent saves use the _id returned from the insert, so they update the document rather than attempting a new insert.
This addresses duplicate _id behavior independently for all ID values, and can use the dedicated insert path as the implementation of the existing TODO.
changed the title [-]Document View: first Add save should insert, not upsert[/-][+]#grid Document View: first Add save should insert, not upsert[/+]on Dec 1, 2026
This is the explicit disposition of #1152 C5. Cover duplicate supplied IDs for both truthy and falsy values, assert that the existing stored document is untouched and the duplicate-key error is reported. Then cover a successful first insert with an explicit or generated ID followed by a second save that updates that same document. Preserve #1142's own-property check for _id; this is not the numeric-representation work in #1145/#1148. Do not silently turn a failed first insert into an update.
changed the title [-]#grid Document View: first Add save should insert, not upsert[/-][+]#grid Document View: first Add save should insert, not upsert #rdg[/+]on Dec 1, 2026
Activity
[-]Document View: first Add save should insert, not upsert[/-][+]#grid Document View: first Add save should insert, not upsert[/+]tnaum-ms commentedon Dec 1, 2026
This is the explicit disposition of #1152 C5. Cover duplicate supplied IDs for both truthy and falsy values, assert that the existing stored document is untouched and the duplicate-key error is reported. Then cover a successful first insert with an explicit or generated ID followed by a second save that updates that same document. Preserve #1142's own-property check for
_id; this is not the numeric-representation work in #1145/#1148. Do not silently turn a failed first insert into an update.[-]#grid Document View: first Add save should insert, not upsert[/-][+]#grid Document View: first Add save should insert, not upsert #rdg[/+]