<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:39:37 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-1443] Count() throws InvalidOperationException</title>
                <link>https://jira.mongodb.org/browse/CSHARP-1443</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;The attached code throws an InvalidOperationException() Sequence contains no elements.&lt;/p&gt;

&lt;p&gt;var items = collection.AsQueryable().Where(o =&amp;gt; o.Id.Length&amp;gt;100).ToList();&lt;br/&gt;
var count = collection.AsQueryable().Where(o =&amp;gt; o.Id.Length&amp;gt;100).Count(); // exception thrown here&lt;/p&gt;

&lt;p&gt;The items value is 0. I want see count value is 0, but have exception.&lt;/p&gt;</description>
                <environment>Window 8 64 bit</environment>
        <key id="234442">CSHARP-1443</key>
            <summary>Count() throws InvalidOperationException</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="4" iconUrl="https://jira.mongodb.org/images/icons/priorities/minor.svg">Minor - P4</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="9">Done</resolution>
                                        <assignee username="craig.wilson@mongodb.com">Craig Wilson</assignee>
                                    <reporter username="IlyaK">Ilya</reporter>
                        <labels>
                    </labels>
                <created>Thu, 15 Oct 2015 07:11:48 +0000</created>
                <updated>Wed, 20 Jan 2016 20:09:47 +0000</updated>
                            <resolved>Fri, 16 Oct 2015 14:35:13 +0000</resolved>
                                    <version>2.1</version>
                                    <fixVersion>2.1</fixVersion>
                                    <component>Linq</component>
                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="1062693" author="xgen-internal-githook" created="Fri, 16 Oct 2015 12:45:00 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;craiggwilson&apos;, u&apos;name&apos;: u&apos;Craig Wilson&apos;, u&apos;email&apos;: u&apos;craiggwilson@gmail.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-1443&quot; title=&quot;Count() throws InvalidOperationException&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-1443&quot;&gt;&lt;del&gt;CSHARP-1443&lt;/del&gt;&lt;/a&gt;: fix issue with no matching documents causing count or sum results of 0 to throw an exception.&lt;br/&gt;
Branch: v2.1.x&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/commit/d9ac8c090bf615e3e075deade29d1e97cc44abe1&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/commit/d9ac8c090bf615e3e075deade29d1e97cc44abe1&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1062690" author="xgen-internal-githook" created="Fri, 16 Oct 2015 12:42:58 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;craiggwilson&apos;, u&apos;name&apos;: u&apos;Craig Wilson&apos;, u&apos;email&apos;: u&apos;craiggwilson@gmail.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-1443&quot; title=&quot;Count() throws InvalidOperationException&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-1443&quot;&gt;&lt;del&gt;CSHARP-1443&lt;/del&gt;&lt;/a&gt;: fix issue with no matching documents causing count or sum results of 0 to throw an exception.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/commit/f76876919511d3b4ad4e27744b2300e4b6e0e87e&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/commit/f76876919511d3b4ad4e27744b2300e4b6e0e87e&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1061973" author="ilyak" created="Thu, 15 Oct 2015 18:44:29 +0000"  >&lt;p&gt;Sorry, version is 2.1.0-rc1. Thanks for your answer.&lt;/p&gt;</comment>
                            <comment id="1061844" author="craiggwilson" created="Thu, 15 Oct 2015 17:24:28 +0000"  >&lt;p&gt;I&apos;ve changed the affects version to 2.1 because 2.0.1 does not include LINQ. &lt;/p&gt;

&lt;p&gt;This does look like it&apos;s a bug related to how aggregate returns a count when no documents match the filter. Thanks for reporting.&lt;/p&gt;

&lt;p&gt;Craig&lt;/p&gt;</comment>
                            <comment id="1061372" author="ilyak" created="Thu, 15 Oct 2015 12:59:52 +0000"  >&lt;p&gt;Hello. Added file with sample.&lt;/p&gt;</comment>
                            <comment id="1061336" author="craiggwilson" created="Thu, 15 Oct 2015 11:53:14 +0000"  >&lt;p&gt;Hi ilya,&lt;/p&gt;

&lt;p&gt;We have a great number of tests that exercise this bit of code. Could you provide a sample console program that causes this to occur?&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
Craig&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="94192" name="Program.cs" size="4166" author="IlyaK" created="Thu, 15 Oct 2015 12:59:47 +0000"/>
                    </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|hsdplj:</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>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="698">C# Sprint 27</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>