[CSHARP-1313] Combing Inc, silent fail Created: 13/Jun/15 Updated: 13/Jun/15 Resolved: 13/Jun/15 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | API |
| Affects Version/s: | 2.0.1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Dwayne Bull | Assignee: | Unassigned |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
CSharp, mono and .net |
||
| Description |
|
Applying: Result: {id:-1}Combining Inc doesn't seem to work, it will overwrite the last inc on the same field, this is made more troublesome by the inability to update a collection with a BsonDocument as the update so you can't get round this. There seems to be no error and no way of querying the UpdateDefinition to see if an existing Inc for the field exists. |
| Comments |
| Comment by Dwayne Bull [ 13/Jun/15 ] | |
|
Fair enough. | |
| Comment by Craig Wilson [ 13/Jun/15 ] | |
|
While there is a remote possibility we could do what you are asking for, I'm going to mark this as won't fix. It would be surprising for this to happen for current users of this driver as well as other drivers. UpdateDefinition is implicitly convertible to a BsonDocument, so you certainly can do what you are asking for. See the documentation here: http://mongodb.github.io/mongo-csharp-driver/2.0/reference/driver/definitions/#updates | |
| Comment by Dwayne Bull [ 13/Jun/15 ] | |
|
I was hoping for the numeric inc to be taken care of client side, so the resulting combined inc would be passed to the server. | |
| Comment by Craig Wilson [ 13/Jun/15 ] | |
|
Hi Dwayne, This is not supported in MongoDB. Overwriting or throwing is our only option. We opted for overwriting. Also, realize that this incrementing is taking place server side. We are constructing the update document
and sending it to the server. Since duplicated fields are not allowed, we simply can't do what you are wanting. Perhaps you could elaborate as to what you need is here and maybe we can figure out another way to handle it. Craig | |
| Comment by Dwayne Bull [ 13/Jun/15 ] | |
|
Edit: If would be good if the result was: {id:0} |