[CSHARP-1865] Unsupported filter exception after upgrading from 2.3 to 2.4 driver Created: 12/Dec/16 Updated: 07/Feb/17 Resolved: 22/Dec/16 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | Linq |
| Affects Version/s: | 2.3 |
| Fix Version/s: | 2.4.1 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Paul Wen | Assignee: | Robert Stam |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Windows 10 x64, Visual Studio 2015, asp.net core C# mongodb driver |
||
| Issue Links: |
|
||||||||||||||||
| Description |
|
The following C# code was working with Mongodb C# driver 2.3 until we upgraded to 2.4 and are now receiving an exception: Unsupported filter: (Convert({document}{QueryId}) == 44).
This is example data within the collection:
The full exception stack trace is as follows:
Again this was working just fine in the 2.3 driver and only started causing an exception after upgrading to 2.4. |
| Comments |
| Comment by Paul Wen [ 22/Dec/16 ] | ||||||||||||||||||||||||||
|
No problem; we only make sure to compare with actual values and not null. Thank you so much for the help! Is there any ETA on 2.4.1 or a beta package for testing? | ||||||||||||||||||||||||||
| Comment by Robert Stam [ 22/Dec/16 ] | ||||||||||||||||||||||||||
|
Fixed by the work on | ||||||||||||||||||||||||||
| Comment by Robert Stam [ 22/Dec/16 ] | ||||||||||||||||||||||||||
|
This looks like it's the same issue as You are comparing a non-nullable member (x.QueryId) to a nullable value (id). Should work now. Keep in mind though that if the value of id is null you probably won't match any documents in the database (presumably there are no QueryId with a value of null because in your POCO QueryId is an int, not a nullable int). | ||||||||||||||||||||||||||
| Comment by Paul Wen [ 19/Dec/16 ] | ||||||||||||||||||||||||||
|
You should be able to reproduce with a class, such as below, and store these objects in a collection. Then when you try to read them back with the query, also below, then it will cause the exception that I originally posted. This is within an ASP.NET Core 1.1.0 application. The code below works fine with Mongo.Driver 2.3.0 but causes the exception with 2.4.0. I can provide a full solution if this does not reproduce for some reason. thank you much
| ||||||||||||||||||||||||||
| Comment by Paul Wen [ 18/Dec/16 ] | ||||||||||||||||||||||||||
|
This is the datatype: public int QueryId { get; set; }I will work in the mean time to see if I can reproduce this exception in a small sample project that I can share with you. | ||||||||||||||||||||||||||
| Comment by Robert Stam [ 13/Dec/16 ] | ||||||||||||||||||||||||||
|
What is the data type of the QueryId property of the AgentAnswer class? I don't think I can attempt to reproduce this without that information. | ||||||||||||||||||||||||||
| Comment by Paul Wen [ 12/Dec/16 ] | ||||||||||||||||||||||||||
|
Just to note those extra line breaks in the collection data example are not actually in the collection there was an issue it seems in copy/paste into this ticket. |