Replies: 1 comment
-
While trying to fix this on our end, we also noticed since CosmosJsonDotNetSerializer.cs is internal, we have to copy it into our codebase in order to change the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Ask
Set MetadataPropertyHandling to Ignore by default in the default CosmosJsonDotNetSerializer. As far as I can tell, these metadata tags are used to keep track of object references, and would not really be helpful in what I imagine the typical Cosmos DB use case is, since a typical user would send the serialized object over the wire right away and never deserialize that same object again. This setting does however seem to cause issues as it did for me and at least a few other issues e.g. #2666 and indirectly in #2671.
Also, coming from other json serializing libraries, I think it's pretty unintuitive that deserialization can even fail because of this
$id
field, so disabling this would also better fit the user expectations.Background
Recently, I was looking into an incident where our service was failing to deserialize objects due to
It turned out, somehow, that we had many objects in our table that had
I am not certain that this was added by the CosmosJsonDotNetSerializer itself, but it's the only serializer that we use to write to this particular table. As a result, when our query contained more than one item with this field, the result would fail to deserialize because of conflicting
$id
fields.We can set MetadataPropertyhandling ourselves, but I was thinking this would affect other uses, and I imagine the setting is more harmful than helpful in a typical DB CRUD scenario.
Beta Was this translation helpful? Give feedback.
All reactions