<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:37:09 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-545] Create document copies in a collection without pulling the document out</title>
                <link>https://jira.mongodb.org/browse/CSHARP-545</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;Is there a way to create a copy of an existing document without pulling out the document to the application. Currently this is what we are doing:&lt;/p&gt;

&lt;p&gt;1) Read the existing document.&lt;br/&gt;
2) Apply some changes (change a field)&lt;br/&gt;
3) Save this document as a new document. (The original document stays the same)&lt;/p&gt;

&lt;p&gt;Since our documents can be big, so we were wondering if we can do this:&lt;/p&gt;

&lt;p&gt;1) Call some function with a document id and the fields we want to change.&lt;br/&gt;
2) On the mongo server side, the document is read, changed and a new document is created.&lt;/p&gt;


&lt;p&gt;This way we are hoping to avoid pulling the document out of the mongo to the application. We think we can gain some performance out of it.&lt;/p&gt;

&lt;p&gt;Is this supported? (Maybe through a javascript function).&lt;br/&gt;
If its possible then is this approach recommended?&lt;br/&gt;
Can you suggest something different that might be a better solution?&lt;/p&gt;</description>
                <environment></environment>
        <key id="47477">CSHARP-545</key>
            <summary>Create document copies in a collection without pulling the document out</summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</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="-1">Unassigned</assignee>
                                    <reporter username="zarian.waheed@rms.com">Zarian Waheed</reporter>
                        <labels>
                            <label>question</label>
                    </labels>
                <created>Fri, 17 Aug 2012 19:08:00 +0000</created>
                <updated>Fri, 5 Apr 2019 13:58:24 +0000</updated>
                            <resolved>Mon, 27 Aug 2012 17:39:55 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>0</watches>
                                                                                                                <comments>
                            <comment id="154513" author="craiggwilson" created="Fri, 17 Aug 2012 20:16:30 +0000"  >&lt;p&gt;First off, please use the google groups for questions like this. You can get to it here: &lt;a href=&quot;https://groups.google.com/forum/#!forum/mongodb-user&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://groups.google.com/forum/#!forum/mongodb-user&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Answer:&lt;br/&gt;
  It&apos;s generally not advisable to use a server side javascript function for this.  The current javascript interpreter on the server is single-threaded and it would definitely impact your throughput.  However, there are ways of sending updates to the server without reading the document, changing it, and sending it back.  You can read about the update method here: &lt;a href=&quot;http://www.mongodb.org/display/DOCS/Updating/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://www.mongodb.org/display/DOCS/Updating/&lt;/a&gt; and the corresponding method in the driver to execute them. &lt;a href=&quot;http://www.mongodb.org/display/DOCS/CSharp+Driver+Tutorial#CSharpDriverTutorial-Updatemethod&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://www.mongodb.org/display/DOCS/CSharp+Driver+Tutorial#CSharpDriverTutorial-Updatemethod&lt;/a&gt;.  Also, take notice of the findAndModify command.&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|hrh787:</customfieldvalue>

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