[CSHARP-3289] No return type for InsertOne and InsertMany Created: 15/Dec/20 Updated: 31/Mar/22 |
|
| Status: | Backlog |
| Project: | C# Driver |
| Component/s: | API |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Nick Parker | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | next-major | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Case: | (copied to CRM) |
| Description |
|
Hi Please can you review the following for a future improvement: InsertOne(), InsertOneAsync(), InsertMany(), InsertManyAsync() methods do not return anything. They should return something I would expect an object based on the other methods below: DeleteOne and DeleteOneAsync() returns a DeleteResult object UpdateOne and UpdateOneAsync() returns an UpdateResult object
I have worked around this using the BulkInsert/BulkInsertResult but the above insert methods should return an InsertResult object. The Java driver does return an InsertResult object.
Many thanks |
| Comments |
| Comment by Mikalai Mazurenka (Inactive) [ 17/Dec/20 ] | ||||||||
|
nick.parker@sainsburys.co.uk thank you for reporting this issue. | ||||||||
| Comment by Nick Parker [ 17/Dec/20 ] | ||||||||
|
Hi Mikalai An example below but I have hard coded the options and created a class for the result object:
| ||||||||
| Comment by Nick Parker [ 17/Dec/20 ] | ||||||||
|
Hi Mikalai I have created it exactly as I would have expected the driver implementation to be. I return an InsertResult object that is populated from the BulkWriteResult objects values as follows: InsertedCount IsAcknowledged It is the same as the results returned by DeleteOne and DeleteMany methods. | ||||||||
| Comment by Mikalai Mazurenka (Inactive) [ 15/Dec/20 ] | ||||||||
|
Hi nick.parker@sainsburys.co.uk! |