[CSHARP-761] Allow LINQ lambda expressions to be used for queries in .Remove and .Update operations Created: 14/Jun/13 Updated: 20/Mar/14 Resolved: 14/Jun/13 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | Einar Egilsson | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | linq, remove, update | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
The Query and Query<T> API's that we have to use for Update and Remove operations are pretty verbose and annoying to work with. It would be great to be able to use lambda expressions instead. E.g. instead of coll.Update(Query.Or(Query.EQ("Id", "..."), Query.EQ("Name", "John")), update) we could do coll.Update(o => o.Id == "..." || o.Name == "John", update) Same for Remove. Pull request is on it's way... |
| Comments |
| Comment by Craig Wilson [ 14/Jun/13 ] | |
|
An extension method is easy enough to write, so if you would like something like this, feel free to write one. We are currently going through a bit of a redesign of the CRUD syntax for all the drivers and so we'll definitely keep this in mind during that discussion... Thanks for your input!!! | |
| Comment by Einar Egilsson [ 14/Jun/13 ] | |
|
Totally missed that! | |
| Comment by Robert Stam [ 14/Jun/13 ] | |
|
This is already possible. You can do it like this:
|