<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:35:25 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>[GODRIVER-995] FindOne() doesn&apos;t find one with nil filter</title>
                <link>https://jira.mongodb.org/browse/GODRIVER-995</link>
                <project id="14289" key="GODRIVER">Go Driver</project>
                    <description>&lt;p&gt;I was writing code to just grab a TODO item with no filter, but kept getting no document. I was able to easily reproduce with the Trainer example; here&apos;s a snippet:&lt;/p&gt;

&lt;p&gt;	// create a value into which the result can be decoded&lt;br/&gt;
	var result Trainer&lt;/p&gt;

&lt;p&gt;	//err = collection.FindOne(context.TODO(), filter).Decode(&amp;amp;result)&lt;br/&gt;
	err = collection.FindOne(context.TODO(), nil).Decode(&amp;amp;result)&lt;br/&gt;
	if err != nil &lt;/p&gt;
{
		log.Fatal(err)
	}

&lt;p&gt;With nil for filter:&lt;br/&gt;
2019/04/24 10:41:32 document is nil&lt;/p&gt;

&lt;p&gt;If I connect using mongo shell:&lt;br/&gt;
&amp;gt; db.trainers.findOne()&lt;/p&gt;
{ &quot;_id&quot; : &quot;ash&quot;, &quot;name&quot; : &quot;Ash&quot;, &quot;age&quot; : 11, &quot;city&quot; : &quot;Pallet Town&quot; }

&lt;p&gt;I&apos;m working around by supplying a filter that&apos;s true for all records.&lt;/p&gt;</description>
                <environment>Linux, Go 1.12.4, Mongo Docker container created 2019-04-12T00:21:50.281225741Z</environment>
        <key id="744331">GODRIVER-995</key>
            <summary>FindOne() doesn&apos;t find one with nil filter</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</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="13202">Works as Designed</resolution>
                                        <assignee username="divjot.arora@mongodb.com">Divjot Arora</assignee>
                                    <reporter username="parsley42">David L. Parsley</reporter>
                        <labels>
                    </labels>
                <created>Wed, 24 Apr 2019 14:45:55 +0000</created>
                <updated>Fri, 27 Oct 2023 13:16:34 +0000</updated>
                            <resolved>Thu, 25 Apr 2019 22:03:35 +0000</resolved>
                                    <version>1.0.1</version>
                    <version>1.0.0</version>
                                                    <component>CRUD</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="2225388" author="divjot.arora" created="Thu, 25 Apr 2019 22:02:48 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=parsley42&quot; class=&quot;user-hover&quot; rel=&quot;parsley42&quot;&gt;parsley42&lt;/a&gt; The driver&apos;s operations don&apos;t support using nil where a document is expected. Like you mentioned in the description, you should use a filter that matches everything such as&#160;&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;collection.FindOne(context.TODO(), bson.D{})&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;</comment>
                            <comment id="2224596" author="parsley42" created="Thu, 25 Apr 2019 14:09:33 +0000"  >&lt;p&gt;To be perhaps more clear, I&apos;m referring to reproducing this issue with your go driver tutorial: &lt;a href=&quot;https://www.mongodb.com/blog/post/mongodb-go-driver-tutorial&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://www.mongodb.com/blog/post/mongodb-go-driver-tutorial&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                    <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|hukwcf:</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>