[CSHARP-430] LINQ does not support DateTime comparisons Created: 03/Apr/12 Updated: 02/Apr/15 Resolved: 04/Apr/12 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | None |
| Affects Version/s: | 1.4 |
| Fix Version/s: | 1.4.1 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Zaid Masud | Assignee: | Robert Stam |
| Resolution: | Done | Votes: | 0 |
| Labels: | LINQ | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Description |
|
Following exception occurs when applying a comparison operator on a field of type DateTime: Unsupported where clause: (DateTime:(2012-04-03T12:45:32.5348776Z) < s.CreatedOn) The query is as follows: .Where(s => DateTime.UtcNow < s.ExpireOn) Note: This is supported by FluentMongo |
| Comments |
| Comment by Robert Stam [ 04/Apr/12 ] |
|
See |
| Comment by Robert Stam [ 03/Apr/12 ] |
|
The current LINQ implementation requires that the constant be on the right. So you can rewrite the where clause as: .Where(s => s.ExpireOn > DateTime.UtcNow) |