[CSHARP-127] Find by Id - such a common task, should there be a method for it on MongoCollection<T>? Created: 04/Dec/10 Updated: 02/Apr/15 Resolved: 06/Dec/10 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | Feature Request |
| Affects Version/s: | 0.7 |
| Fix Version/s: | 0.9 |
| Type: | New Feature | Priority: | Minor - P4 |
| Reporter: | Ian Mercer | Assignee: | Robert Stam |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
N/A |
||
| Description |
|
It seems that loading an object by it's ID is a very common task. This leads to a lot of repetitive code. If a MongoCollection provided a FindOneById(ObjectId id) method that duplicate code could be eliminated. In MongoCollection.cs on MongoCollection<T> public TDefaultDocument FindOneById (ObjectId id) { return FindOne(Query.EQ("_id", id)); } |
| Comments |
| Comment by Robert Stam [ 06/Dec/10 ] |
|
Added FindOneById and FindOneByIdAs. |