[CSHARP-1099] UpdateBuilder.SetOnInsert interface is incomplete Created: 10/Nov/14  Updated: 04/Apr/15  Resolved: 04/Apr/15

Status: Closed
Project: C# Driver
Component/s: API
Affects Version/s: 1.8.3
Fix Version/s: None

Type: New Feature Priority: Major - P3
Reporter: James O'Leary Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related

 Description   

The current UpdateBuilder API only allows the value of the named element to be set.

See the following code UpdateBuilder.cs#L680:

 public static UpdateBuilder SetOnInsert(string name, BsonValue value)

And UpdateBuilder.cs#L1658:

        public UpdateBuilder SetOnInsert(string name, BsonValue value)

For completeness, we should consider adding an overloaded method to provide a complete document. For example:

 public static UpdateBuilder SetOnInsert(BsonDocument document) { ... }
 public UpdateBuilder SetOnInsert(BsonDocument document) { ... }



 Comments   
Comment by Craig Wilson [ 04/Apr/15 ]

This is part of the legacy API and will not be updated. The new API supports this behavior.

Comment by David Pfeffer [ 12/Nov/14 ]

There should also be a strongly typed version:

public static UpdateBuilder<T> SetOnInsert(T document) { ... }
public UpdateBuilder<T> SetOnInsert(T document) { ... }

Generated at Wed Feb 07 21:38:39 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.