[CSHARP-4027] BsonDiscriminator not always written Created: 31/Jan/22 Updated: 31/Mar/22 |
|
| Status: | Backlog |
| Project: | C# Driver |
| Component/s: | None |
| Affects Version/s: | 2.14.1, 2.13.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Unknown |
| Reporter: | Marc Simkin | Assignee: | Robert Stam |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
| Description |
| Comments |
| Comment by Marc Simkin [ 24/Feb/22 ] | |
|
@Robert Stam, I have spent some time thinking about this issue. IMO, if a NEW document is being inserted, via upsert, than the discriminator should be written. If the document is being UPDATED, if the discriminator doesn't exist (or it has a different value) it should NOT be modified.
| |
| Comment by Marc Simkin [ 02/Feb/22 ] | |
|
Your welcome. Thank you for the work around.
| |
| Comment by Robert Stam [ 02/Feb/22 ] | |
|
Thank you for reporting this. We're thinking about what the proper behavior should be. The way upsert normally works is that it creates a new document by combining values from the filter with instructions from the update specification. This process doesn't normally involve automatically modifying the update instructions to add an additional field like the discriminator. Though maybe it should. An easy workaround in the meantime is to add the discriminator yourself:
|