<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:38:07 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-2235] insertMany api successfully inserted part of the documents, when the context deadline exceeds</title>
                <link>https://jira.mongodb.org/browse/GODRIVER-2235</link>
                <project id="14289" key="GODRIVER">Go Driver</project>
                    <description>&lt;p&gt;mongo-driver version: go.mongodb.org/mongo-driver v1.5.0&lt;/p&gt;

&lt;p&gt;mongo server: sharded clusters with 2 shard, version: 4.2,&#160;WiredTiger engine&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;I use InsertMany API to insert 100000 documents (all documents will be hashed to the same shard), when context deadline exceed, it returned error, and part of the documents was inserted.&lt;/p&gt;

&lt;p&gt;I expect that the&#160;InsertMany API is an atomic operation, but it is not.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</description>
                <environment></environment>
        <key id="1927274">GODRIVER-2235</key>
            <summary>insertMany api successfully inserted part of the documents, when the context deadline exceeds</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="2" iconUrl="https://jira.mongodb.org/images/icons/priorities/critical.svg">Critical - P2</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="13203">Gone away</resolution>
                                        <assignee username="benji.rewis@mongodb.com">Benji Rewis</assignee>
                                    <reporter username="liuwenzhe_neoye@163.com">Liu Wenzhe</reporter>
                        <labels>
                    </labels>
                <created>Wed, 17 Nov 2021 10:41:23 +0000</created>
                <updated>Fri, 27 Oct 2023 20:01:14 +0000</updated>
                            <resolved>Tue, 14 Dec 2021 12:00:28 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="4246405" author="dbeng-pm-bot" created="Tue, 14 Dec 2021 12:00:30 +0000"  >&lt;p&gt;There hasn&apos;t been any recent activity on this ticket, so we&apos;re resolving it. Thanks for reaching out! Please feel free to comment on this if you&apos;re able to provide more information.&lt;/p&gt;</comment>
                            <comment id="4215202" author="benji.rewis" created="Mon, 29 Nov 2021 17:41:41 +0000"  >&lt;p&gt;Apologies for the delay in response &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=liuwenzhe_neoye%40163.com&quot; class=&quot;user-hover&quot; rel=&quot;liuwenzhe_neoye@163.com&quot;&gt;liuwenzhe_neoye@163.com&lt;/a&gt;, and thank you for your bug report!&lt;/p&gt;

&lt;p&gt;If there&#8217;s a deadline on the context provided to the operation (i.e. it&#8217;s not a &lt;tt&gt;nil&lt;/tt&gt; context nor &lt;tt&gt;context.Background()&lt;/tt&gt;), and the &lt;tt&gt;InsertMany&lt;/tt&gt; operation cannot complete before the deadline expires, it would be expected behavior that only a subset of documents would be inserted and an error would be returned.&lt;/p&gt;

&lt;p&gt;All this to say that &lt;tt&gt;InsertMany&lt;/tt&gt; is indeed &lt;em&gt;not&lt;/em&gt; an atomic operation across the wire. To make the operation more &#8220;atomic&#8221;, I&#8217;d suggest you either use a transaction, which has logic to retry the operation if it fails, or you extend the deadline of your context to account for long-running &lt;tt&gt;InsertMany&lt;/tt&gt; operations.&lt;/p&gt;

&lt;p&gt;Let me know if neither of those sound like options for you, and we can come up with a different workaround. But, the Go driver does honor context cancellations/expirations even in the middle of operations.&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|hzu2of:</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>