I had avoided this as it seemed unnecessary from the protocol perspective. (i.e. on the server its up to the server implementation what it does), but in a more general sense it would be useful for clients to know how to merge two representations.
Proposal:
In general we just merge the top level properties from both objects and add the _id to a _sameas collection. (see Topic Maps subject identifiers as another example of this).
Merge rules:
Given subject representations: A and B a new representation C is produced.
It is produced by ordering the two representations by the _id value. (B can become A)
Then iterate the set of properties in A. For any whose key is not in B add it to C.
For any property in A where there is a corresponding property in B the property values are merged.
The merging rules are as follows:
if both value types are lists then create a new list and add all the elements of the A list and the B list into it.
Create a new list and add the value of A and B properties into it.
I had avoided this as it seemed unnecessary from the protocol perspective. (i.e. on the server its up to the server implementation what it does), but in a more general sense it would be useful for clients to know how to merge two representations.
Proposal: In general we just merge the top level properties from both objects and add the _id to a _sameas collection. (see Topic Maps subject identifiers as another example of this).
Merge rules:
Given subject representations: A and B a new representation C is produced.
It is produced by ordering the two representations by the _id value. (B can become A)
Then iterate the set of properties in A. For any whose key is not in B add it to C.
For any property in A where there is a corresponding property in B the property values are merged.
The merging rules are as follows:
if both value types are lists then create a new list and add all the elements of the A list and the B list into it.
Create a new list and add the value of A and B properties into it.