[CSHARP-1046] Type-safe $set with positional operator "$" Created: 21/Aug/14 Updated: 09/Mar/15 Resolved: 09/Mar/15 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | API |
| Affects Version/s: | 1.9.2 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Svetoslav Milenov | Assignee: | Unassigned |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | driver | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||
| Description |
|
Currently the only way to use a positional operator & for updating a field in embedded array is to use the not type safe Update.Set with manually constructing the statement like:
A method can be added to the generic Update<TDocument> and UpdateBuilder<TDocument> to avoid hard-codding strings (there is already similar approach with Query<T>.ElemMatch):
|
| Comments |
| Comment by Craig Wilson [ 09/Mar/15 ] | ||
|
This has been resolved. See the commit link in It is only applicable to the new API in 2.0.0. -1 can be used as an indexer or with GetElementAt to indicate to us to use the positional operator. For example:
| ||
| Comment by Svetoslav Milenov [ 21/Aug/14 ] | ||
|
Pull request submitted: https://github.com/mongodb/mongo-csharp-driver/pull/187 |