<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:47:16 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[CSHARP-4115] Query against strings (case insensitive)</title>
                <link>https://jira.mongodb.org/browse/CSHARP-4115</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;I am using the MongoDB C# client to construct queries like &quot;Name &amp;gt; &apos;Aardvark&apos;&quot;.&#160; I can easily create a query that filters on strings case-sensitively, like this:&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;return Builders&amp;lt;T&amp;gt;.Filter.Gt(&quot;Name&quot;, &quot;Aardvark&quot;);&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;I can&apos;t seem to find an option for comparing strings case insensitively.&#160; If I was writing the query directly in MongoDB, the query would look like this:&lt;/p&gt;

&lt;p&gt;{&lt;tt&gt;&#160;&lt;/tt&gt;&lt;tt&gt;$expr: {&#160;&lt;/tt&gt;&lt;tt&gt;$gte: [&#160;&lt;/tt&gt;{{{ $strcasecmp: [ &quot;$Name&quot;, &quot;}}&lt;tt&gt;Aardvark&lt;/tt&gt;&lt;tt&gt;&quot;] },&#160;&lt;/tt&gt;&lt;tt&gt;0&#160;&lt;/tt&gt;&lt;tt&gt;]&#160;&lt;/tt&gt;&lt;tt&gt;}&#160;&lt;/tt&gt;&lt;tt&gt;}&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;It seems like it should be possible to do this with the .Where() function, but that function only recognizes `obj =&amp;gt; obj.Name.Equals(&quot;Aardvark&quot;, OrdinalIgnoreCase)`.&#160; It doesn&apos;t seem to permit any comparisons.&lt;/p&gt;

&lt;p&gt;When I try the following, I get an error executing my query:&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;return Builders&amp;lt;T&amp;gt;.Filter.Where(x =&amp;gt; String.Compare(x.Name, &quot;Aardvark&quot;, OrdinalIgnoreCase);&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;Is there a better way to do this, or is this not implemented today?&lt;/p&gt;</description>
                <environment></environment>
        <key id="2010833">CSHARP-4115</key>
            <summary>Query against strings (case insensitive)</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="10300" iconUrl="https://jira.mongodb.org/images/icons/priorities/medium.svg">Unknown</priority>
                        <status id="10038" iconUrl="https://jira.mongodb.org/images/icons/subtask.gif" description="">Backlog</status>
                    <statusCategory id="2" key="new" colorName="default"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="robert@mongodb.com">Robert Stam</assignee>
                                    <reporter username="ted@spence.net">Theodore Spence</reporter>
                        <labels>
                    </labels>
                <created>Mon, 28 Mar 2022 22:42:33 +0000</created>
                <updated>Thu, 18 Jan 2024 15:51:57 +0000</updated>
                                                                                                <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="4442457" author="JIRAUSER1269676" created="Tue, 29 Mar 2022 16:52:23 +0000"  >&lt;p&gt;If it helps: My use case doesn&apos;t require precise collation logic. As long as there&apos;s a way to address the challenges of sorting in languages that have different capital characters and lowercase characters yet treat them somewhat interchangeably, I will be happy enough with the solution.  &lt;/p&gt;

&lt;p&gt;I would also be totally okay if the driver just had a `Builder.StrCaseCmp(field, value, comparison)` function and you had to intentionally choose to use that so there was no ambiguity about which collation rules would be in effect.&lt;/p&gt;</comment>
                            <comment id="4442374" author="JIRAUSER1269676" created="Tue, 29 Mar 2022 16:33:03 +0000"  >&lt;p&gt;Awesome, thank you so much for the update!&#160; I think I didn&apos;t see that Jira ticket originally because I was searching for `$strcasecmp`.&lt;/p&gt;

&lt;p&gt;I submitted &lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/pull/758&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/pull/758&lt;/a&gt;&#160;as a rudimentary way of executing this, but please feel free to reject the PR or make use of it however you prefer.&lt;/p&gt;</comment>
                            <comment id="4442303" author="rstam" created="Tue, 29 Mar 2022 16:16:05 +0000"  >&lt;p&gt;We are working on this as part of &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-4100&quot; title=&quot;Review uses of StringComparison in StartsWith, Contains and EndsWith&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-4100&quot;&gt;&lt;del&gt;CSHARP-4100&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Note that you will use `StringCompare.CurrentCultureIgnoreCase` instead of `StringCompare.OrdinalIgnoreCase`.&lt;/p&gt;

&lt;p&gt;This is because the server does not have much support for ordinal operations. What it does have is the ability to set a &quot;collation&quot; for the entire pipeline. We have decided that the best we can do is interpret &quot;current culture&quot; as a way of saying &quot;pipeline collation&quot;.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                            <outwardlinks description="duplicates">
                                        <issuelink>
            <issuekey id="2001036">CSHARP-4100</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|i07uas:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>