[COMPASS-4345] Compass does a replace instead of an update when documents are edited. Created: 08/Jul/20  Updated: 29/Oct/23  Resolved: 28/Sep/20

Status: Closed
Project: Compass
Component/s: None
Affects Version/s: None
Fix Version/s: 1.24.1

Type: Story Priority: Major - P3
Reporter: Massimiliano Marcon Assignee: Rhys Howell
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Documented
Related
related to COMPASS-5528 Compass replaces whole array if you u... Closed
is related to COMPASS-5753 JSON editor is the only way to change... Open
Story Points: 3
Documentation Changes: Needed
Documentation Changes Summary:

This ticket updates the functionality of document editing. Instead of replacing a document, and possibly losing changes which occurred in the background, this change makes it so that the documents are now updated. In cases where the fields being changed do not exist in the form which they were originally shown to a user, we show a message: `Document was modified in the background or it longer exists. Do you wish to continue and possibly overwrite new changes?` If the users clicks 'update' the document is replaced, if the user clicks 'cancel', the document is returned to its original unedited state.

With the JSON editor view, documents are still fully replaced. The table view uses the new update functionality.

Sprint: Iteration Icaco, Iteration Jackfruit, Iteration Kiwi, Iteration Lime, Iteration Maracuja

 Description   

Feedback from drew.dipalma on this:

We’re seeing more and more issues with Compass/Data Explorer using a ‘replace’ vs. ‘update’ when changes are made – is this some that’s planned to change in the future?

The core of what’s causing this to come up more is that it’s emerging as a common pattern to test sync with an emulator + Compass/Explorer. However, as replace is being used when someone makes a change offline on an emulator and then changes in our tools the emulator update is overwritten even if the updates were to separate fields.

We’re still seeing the issue we talked about before around testing Triggers, but this new case is even less intuitive for users.

Open questions

  • If we do nothing about this, will the VS Code extension have the same behavior when we implement document editing?


 Comments   
Comment by Rhys Howell [ 28/Sep/20 ]

Compass merge commit: https://github.com/mongodb-js/compass/commit/629d9edb4c9700af458dd7039a452f4a1ed017d2

Comment by Githook User [ 28/Sep/20 ]

Author:

{'name': 'Rhys', 'email': 'Anemy@users.noreply.github.com', 'username': 'Anemy'}

Message: COMPASS-4345: Update hadron document and compass-crud to bring in update instead of replace change (#2023)
Branch: master
https://github.com/mongodb-js/compass/commit/629d9edb4c9700af458dd7039a452f4a1ed017d2

Comment by Githook User [ 03/Aug/20 ]

Author:

{'name': 'Rhys', 'email': 'Anemy@users.noreply.github.com', 'username': 'Anemy'}

Message: COMPASS-4345: Add findOneAndUpdate (#240)
Branch: master
https://github.com/mongodb-js/data-service/commit/3402949bd29e40c5ddbad540b0407d8a5dbd1b8c

Generated at Wed Feb 07 22:36:03 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.