[CSHARP-2630] query filter on datetime field with lambda expression gives System.InvalidOperationException: {document..} is not supported Created: 11/Jun/19 Updated: 25/Jun/20 Resolved: 25/Jun/20 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | Builders, Linq |
| Affects Version/s: | 2.8.0 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Poonam | Assignee: | Wan Bachtiar |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Windows server 2012, visual studio, C# mongodb .net driver |
||
| Description |
|
Could you please assist to get query working for below criteria ?
var filter3 = Builders<documentType>.Filter.Gt(f => f.usehour, 0) //& Builders<documentType>.Filter.Gt(f => f.ExpirationDate.AddHours(f.usehour) , DateTime.Now); // tried this also
Exception details: {document}{ExpirationDate}.AddHours(Convert({document}{usehour}, Double)) is not supported.{System.InvalidOperationException: {document} {ExpirationDate} .AddHours(Convert({document} {usehour}, Double)) is not supported.
|
| Comments |
| Comment by Rachelle Palmer [ 25/Jun/20 ] |
|
Hi there, thank you for reaching out to MongoDB. As this sounds more like a support issue, I wanted to give you some resources to get this question answered more quickly:
Thank you! |
| Comment by Poonam [ 11/Jun/19 ] |
|
if try with this Builders<documnetType>.Filter.Gt(f => f.ExpirationDate.AddHours(f.usehour) , DateTime.Now); gives this exception Unable to determine the serialization information for f.ExpirationDate.AddHours(f.usehour) |