[CSHARP-457] Strong Typed Query/Update/SortBy/Etc Builders Created: 30/Apr/12 Updated: 02/Apr/15 Resolved: 22/May/12 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | Feature Request |
| Affects Version/s: | 1.4.2 |
| Fix Version/s: | 1.5 |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Ryan Hoffman | Assignee: | Craig Wilson |
| Resolution: | Done | Votes: | 4 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
It would be great to reduce the use of "magic strings" when using the query/update builders. If there could be a new Builder<T> static types (like Query<T> and Update<T>) which would have methods similar to the following signature: Query.EQ(Func<T, object> name, BsonValue value) It could be used like this: |
| Comments |
| Comment by Seb Michaud [ 18/Jul/12 ] |
|
Thanks Craig, I have created a new issue here (https://jira.mongodb.org/browse/CSHARP-531) |
| Comment by Craig Wilson [ 18/Jul/12 ] |
|
There is no support for this. If you'd like to file a different JIRA for this, then feel free. If you do, please try and include a sample of how you would like this to look (not the implementation, just the api portion). |
| Comment by Seb Michaud [ 18/Jul/12 ] |
|
Great feature, is there LINQ support for updates to nested arrays where the positional operator is currently used? e.g. Update.Set("Entity.$.Field", "value") It looks like no as this would probably require a second generic type for the nested object being updated. Is this planned at all? |
| Comment by Craig Wilson [ 22/May/12 ] |
|
pulled into master. |
| Comment by Ryan Hoffman [ 08/May/12 ] |
|
Craig, I have taken a look at the tests and I can't wait for this in the driver |
| Comment by Craig Wilson [ 08/May/12 ] |
|
Alex, I'm very interested in your implementation. I have fully functional code here if you wouldn't mind taking a look and letting me know what you think, offering suggestions, or letting me know that yours is better (in which case I'd like to see yours so we can use it instead) |
| Comment by Alexander Nagy [ 05/May/12 ] |
|
I've got these exact semantics implemented in our private branch, it wouldn't be hard to issue a pull request. Do let me know if you would like the code as it will save a lot of copy/small edit/replace time. |
| Comment by Craig Wilson [ 04/May/12 ] |
|
We are looking at possibilities to implement this as we also feel that magic strings are bad. Stay tuned for more information. |