@@ -45,7 +45,7 @@ The instance with the smaller ID wins, so the key becomes an object in the given
4545| Time | Description | Instance 1 | Instance 2 |
4646| :---: | :--- | :--- | :--- |
4747| t1 | Set the same key to an object or an array | JSON.SET doc $.a '{}' | JSON.SET doc $.a '[ ] ' |
48- | t2 | Add data to the object and array | <nobr >JSON.SET doc $.a.x '“y” '</nobr > <br /><br /> Result: <br /> {"a": {"x": "y"}} | <nobr >JSON.SET doc $.a '[ "z"] '</nobr > <br /><br /> Result: <br /> {“a” : [ "z"] } |
48+ | t2 | Add data to the object and array | <nobr >JSON.SET doc $.a.x '"y" '</nobr > <br /><br /> Result: <br /> {"a": {"x": "y"}} | <nobr >JSON.SET doc $.a '[ "z"] '</nobr > <br /><br /> Result: <br /> {"a" : [ "z"] } |
4949| t3 | Active-Active synchronization | – Sync – | – Sync – |
5050| t4 | Instance 1 wins | JSON.GET doc $ <br /><br /> Result: <br /> {"a": {"x": "y"}} | JSON.GET doc $ <br /><br /> Result: <br /> {"a": {"x": "y"}} |
5151
@@ -267,8 +267,8 @@ Merges the results of all operations on the array. Preserves the original elemen
267267| Time | Description | Instance 1 | Instance 2 |
268268| :---: | :--- | :--- | :--- |
269269| t1 | The document exists on both instances | JSON.GET doc $ < br /><br /> Result: < br /> ' ["a", "b", "c"]' | JSON.GET doc $ < br /><br /> Result: < br /> ' ["a", "b", "c"]' |
270- | t2 | Instance 1 removes an array element; instance 2 adds one | JSON.ARRPOP doc $ 1 < br /><br /> Result: < br /> [" a" , " c" ] | < nobr> JSON.ARRINSERT doc $ 0 ‘“y” ’< /nobr> < br /><br /> Result: < br /> [" y" , " a" , " b" , " c" ] |
271- | t3 | Both instances add another element to the array | < nobr> JSON.ARRINSERT doc $ 1 ‘“x” ’< /nobr> < br /><br /> Result: < br /> [" a" , " x" , " c" ] | < nobr> JSON.ARRINSERT doc $ 2 ‘“z” ’< /nobr> < br /><br /> Result: < br /> [" y" , " a" , " z" , " b" , " c" ] |
270+ | t2 | Instance 1 removes an array element; instance 2 adds one | JSON.ARRPOP doc $ 1 < br /><br /> Result: < br /> [" a" , " c" ] | < nobr> JSON.ARRINSERT doc $ 0 ‘" y " ’< /nobr> < br /><br /> Result: < br /> [" y" , " a" , " b" , " c" ] |
271+ | t3 | Both instances add another element to the array | < nobr> JSON.ARRINSERT doc $ 1 ‘" x " ’< /nobr> < br /><br /> Result: < br /> [" a" , " x" , " c" ] | < nobr> JSON.ARRINSERT doc $ 2 ‘" z " ’< /nobr> < br /><br /> Result: < br /> [" y" , " a" , " z" , " b" , " c" ] |
272272| t4 | Active-Active synchronization | – Sync – | – Sync – |
273273| t5 | Merge results from both instances | JSON.GET doc $ < br /><br /> Result: < br /> [" y" , " a" , " x" , " z" , " c" ] | JSON.GET doc $ < br /><br /> Result: < br /> [" y" , " a" , " x" , " z" , " c" ] |
274274
@@ -292,11 +292,11 @@ Deletion wins over updates.
292292
293293| Time | Description | Instance 1 | Instance 2 |
294294| :---: | :--- | :--- | :--- |
295- | t1 | The document exists on both instances | JSON.GET doc $ < br /><br /> Result: < br /> {“ todo” : [{“ title”: “ buy milk”, “ done” : false}]} | JSON.GET doc $ < br /><br /> Result: < br /> {“ todo” : [{“ title”: “ buy milk”, “ done” : false}]} |
295+ | t1 | The document exists on both instances | JSON.GET doc $ < br /><br /> Result: < br /> {" todo" : [{" title" : " buy milk" , " done" : false}]} | JSON.GET doc $ < br /><br /> Result: < br /> {" todo" : [{" title" : " buy milk" , " done" : false}]} |
296296| t2 | Instance 1 removes an array element; instance 2 updates the same element | < nobr> JSON.ARRPOP doc $.todo 0< /nobr> | < nobr> JSON.SET doc ' $.todo[0]["done"]' ' true' ’< /nobr> |
297- | t3 | | JSON.GET doc $ < br /><br /> Result: < br /> {“ todo” : []} | JSON.GET doc $ < br /><br /> Result: < br /> [{“ title”: “ buy milk”, “ done” : true}]} |
297+ | t3 | | JSON.GET doc $ < br /><br /> Result: < br /> {" todo" : []} | JSON.GET doc $ < br /><br /> Result: < br /> [{" title" : " buy milk" , " done" : true}]} |
298298| t4 | Active-Active synchronization | – Sync – | – Sync – |
299- | t5 | Instance 1 wins | JSON.GET doc $ < br /><br /> Result: < br /> doc = {“ todo” : []} | JSON.GET doc $ < br /><br /> Result: < br /> doc = {“ todo” : []} |
299+ | t5 | Instance 1 wins | JSON.GET doc $ < br /><br /> Result: < br /> doc = {" todo" : []} | JSON.GET doc $ < br /><br /> Result: < br /> doc = {" todo" : []} |
300300
301301# ## Update versus update object
302302
@@ -317,8 +317,8 @@ Merges the results of all operations on the object.
317317| Time | Description | Instance 1 | Instance 2 |
318318| :---: | :--- | :--- | :--- |
319319| t1 | The document exists on both instances | JSON.GET doc $ < br /><br /> Result: < br /> ' {"grocery": []}' | JSON.GET doc $ < br /><br /> Result: < br /> ' {"grocery": []}' |
320- | t2 | Add new elements to the array | < nobr> JSON.ARRAPPEND doc $.grocery ‘“ eggs” ’< /nobr> | JSON.ARRAPPEND doc $.grocery ‘“ milk” ’ |
321- | t3 | Add new elements to the array | JSON.ARRAPPEND doc $.grocery ‘“ ham” ’ | < nobr> JSON.ARRAPPEND doc $.grocery ‘“ flour” ’< /nobr> |
320+ | t2 | Add new elements to the array | < nobr> JSON.ARRAPPEND doc $.grocery ‘" eggs" ’< /nobr> | JSON.ARRAPPEND doc $.grocery ‘" milk" ’ |
321+ | t3 | Add new elements to the array | JSON.ARRAPPEND doc $.grocery ‘" ham" ’ | < nobr> JSON.ARRAPPEND doc $.grocery ‘" flour" ’< /nobr> |
322322| t4 | | JSON.GET doc $ < br /><br /> Result: < br /> {" grocery" :[" eggs" , " ham" ]} | JSON.GET doc $ < br /><br /> Result: < br /> {" grocery" :[" milk" , " flour" ]} |
323323| t5 | Active-Active synchronization | – Sync – | – Sync – |
324324| t6 | Merges the results from both instances | JSON.GET doc . < br /><br /> Result: < br /> {" grocery" :[" eggs" ," ham" ," milk" , " flour" ]} | JSON.GET doc . < br /><br /> Result: < br /> {" grocery" :[" eggs" ," ham" ," milk" , " flour" ]} |
0 commit comments