[CSHARP-983] string methods trim, substring, and concat throw not supported exception. Created: 02/Jun/14  Updated: 05/Apr/19  Resolved: 25/Mar/19

Status: Closed
Project: C# Driver
Component/s: API, Linq, Operations
Affects Version/s: 1.9
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: bothead Assignee: Unassigned
Resolution: Done Votes: 0
Labels: question
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

.NET 4.5, Win 7, VS2012, Web API 2.2 OData v4.



 Description   

When attempting to use a Web API service (v2.2) with OData v4 (nightly build 5.2.0-alpha1-140420) the following string functions do not work:
Trim
Substring
Concat

These are functions that per the OData v4 spec we must support (http://docs.oasis-open.org/odata/odata/v4.0/odata-v4.0-part1-protocol.html):
concat(concat(City,', '), Country) eq 'Berlin, Germany'
trim(CompanyName) eq 'Alfreds Futterkiste'
substring(CompanyName,1) eq 'lfreds Futterkiste'



 Comments   
Comment by Ian Whalen (Inactive) [ 25/Mar/19 ]

This ticket looks to be against the 1.x LINQ implementation - please open a new ticket if you find the 2.x implementation still lacks some features that the server now supports.

Comment by Craig Wilson [ 18/Apr/15 ]

We are beholden to the server on what it supports. For instance, Trim() doesn't exist anywhere on the server, so we can't translate a Trim call at all. However, in projections ($project, $group), we can translate Substring and Concat, but the same isn't true in a predicate ($match) since the same language doesn't exist in both.

In short, we'll be supporting what we can where we can.

Comment by bothead [ 02/Jun/14 ]

Simple LINQ test for trim:
var trimmedName = from p in repository.All() – Returns mongo queryable collection
where p.InstanceId == instanceId && p.Name.Trim() == string.Empty
select p;
var singleC = trimmedName.SingleOrDefault(); – Fails
singleC.Should().NotBeNull();

Generated at Wed Feb 07 21:38:21 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.