[CSHARP-611] Support for Enumerable.Any in LINQ queries for StringSerializer like List<string> Properties Created: 23/Oct/12 Updated: 27/May/22 Resolved: 24/Apr/15 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | None |
| Affects Version/s: | 1.6.1 |
| Fix Version/s: | 2.1 |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | Huseyin Yurtseven | Assignee: | Craig Wilson |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||||||
| Issue Links: |
|
||||||||||||
| Epic Link: | Rewrite Linq | ||||||||||||
| Server Compat: | 2.6 | ||||||||||||
| Backwards Compatibility: | Major Change | ||||||||||||
| Description |
|
In OData Any Queries for IList<string> properties like ?$filter=Links/any(x: x eq '/movies/') don't work and it gives "Any is only support for items that serialize into documents. The current serializer is StringSerializer and must implement IBsonDocumentSerializer for participation in Any queries." error. That would be good to add support like these queries or x=>x.Links.Any(l=>l.StartsWith("/mov")) |
| Comments |
| Comment by Craig Wilson [ 24/Apr/15 ] |
|
This was fixed with |
| Comment by Craig Wilson [ 23/Oct/12 ] |
|
If you see when we implemented this in |
| Comment by Huseyin Yurtseven [ 23/Oct/12 ] |
|
Hi, Thanks for you quick reply. 1) We use latest 1.6 version as Driver 2) We use System.Web.Http.OData as Odata Provider and ASP.NET MVC Web Api with Queryable attribute [Queryable(EnsureStableOrdering = false, HandleNullPropagation = HandleNullPropagationOption.False, ResultLimit = 100)] 3) Sample class hierarchy (by the way i tried without inheritance with plan class) Base [_id, Title, Description etc.] 4) I attached a screenshot and i'm writing a sample linq query. Here is the query: var collection = _context.GetDatabase().GetCollection("Contents").AsQueryable<Content>(); var list = collection.Where(x => x.Links.Any(l => l.StartsWith("/diziler/"))); And you can look attached file. Thanks |
| Comment by Huseyin Yurtseven [ 23/Oct/12 ] |
|
Error screen |
| Comment by Craig Wilson [ 23/Oct/12 ] |
|
First of all, what OData library are you using? We don't have any odata libraries, so I can only assume you are using the ReflectionProvider. There are a number of issues with using the ReflectionProvider with our linq implementation simply because OData requires some very specific things. So, if you could provide some more information: 1) What version of the driver are you using? |