I am looking at
Some thoughts into how this might be done on Mongo
updatedAt, version and updatedAt fields and a _deleted flag that says when the change occurred as well as if the document was deleted in the operation. docId field that stores the _id of the original documentsets field that contains a map of name of updated field to field value after update.findOneAndUpdate command with a filter like { _id: "meh", version: 5, _deleted:{ $ne: true } }, if it succeeds go to (iii).findOne query with just the _id and _deleted filter. If we get a valid result, the versions do not match. We then proceed to check if the field that is being updated, has already been updated between version:5 and the current state, this will be done by making use of the delta table. If it has, we reject the update and abort the procedure. If it has not, we bump the version in the update document then retry from (i)We can already issue delta queries with what is currently on master.
Lets continue updating this thread. Pinned it to the repo
Delta Queries: Use the same to fetch what fields changed since a given timestamp.
This goes to the bin after #1744 , gonna edit that out
@wtrocki I would like to propose something else for the Server-side conflict resolution: current strategy is to use findOneAndUpdate then use findOne to check if there are conflicts, resolve conflicts then try again
I would like to propose the following:
findOne to get the document in the databasefindOneAndUpdate, if failed, restart the procedureWhy: Previous procedure is only suitable for _version conflicts, but proposed procedure can be modified to suit any conflict detection and resolution
Catch: Even if there are no conflicts, we have to make at least two database calls
(I probably haven't thought through everything)
yep. You have described how this works. Yo avoid loop we need to repeat this max x times. x can be 2 or 3 or whatever
Completed in #1833