[CSHARP-296] Update.Pull doesn't support queries on scalar elements Created: 03/Aug/11 Updated: 02/Apr/15 Resolved: 11/Jun/12 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | None |
| Affects Version/s: | 1.1 |
| Fix Version/s: | 1.5 |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Robert Stam | Assignee: | Unassigned |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
See: https://groups.google.com/group/mongodb-user/browse_thread/thread/84b0adb061de5bf4# The C# driver has no way to express the following Pull update modifier: { $pull : { field : { $gt : 3 }} } |
| Comments |
| Comment by Robert Stam [ 11/Jun/12 ] | ||||
|
Providing update builder support for this doesn't seem worth it. We would have to provide a whole matching builder class which didn't use a field name as part of the queries. I think the answer to this is that in the unusual case where you actually need this variant of the $pull you can build the update manually, as in:
| ||||
| Comment by Robert Stam [ 18/Oct/11 ] | ||||
|
I don't think the pull request solves the problem correctly (it allows you to write many invalid update operations because IMongoQuery allows arbitrary queries in addition to the valid subset for the particular Update.Pull use case). Pushing this to 1.4 to allow more time for a proper solution. | ||||
| Comment by Brian Knight [ 20/Sep/11 ] | ||||
|
Submitted pull request 69 that resolves this bug. Added an overloaded method to Update.Pull and UpdateBuilder.Pull to allow IMongoQuery objects to be passed in without a name. This allows the desired behaviour to be accomplished. A new unit test was also added to test the overloaded method. |