If the JSON contains a version field, then it would be possible to prevent accidental overwrites by having each writer pass in the version it's updating. The first would succeed and the second would get an status indicating that the write failed due to the 'optimistic version lock', at which point the operation would be retried by first re-reading the current version.
Another approach which could be better in some cases is support for PATCH where incremental addition/update/delete could be made to a document.
Found that mixing short and long paths effectively PATCH the document of the main hash. This wasn't obvious from the README if not already familiar with Firebase. The filtered PUT is still good to have.
If the JSON contains a
version
field, then it would be possible to prevent accidental overwrites by having each writer pass in the version it's updating. The first would succeed and the second would get an status indicating that the write failed due to the 'optimistic version lock', at which point the operation would be retried by first re-reading the current version.Another approach which could be better in some cases is support for
PATCH
where incremental addition/update/delete could be made to a document.