<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:36:21 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-274] The overloads of Insert and Save in MongoCollection should match</title>
                <link>https://jira.mongodb.org/browse/CSHARP-274</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;Right now Insert has two more overloads than Save. Make them match.&lt;/p&gt;</description>
                <environment></environment>
        <key id="19954">CSHARP-274</key>
            <summary>The overloads of Insert and Save in MongoCollection should match</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</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="robert@mongodb.com">Robert Stam</assignee>
                                    <reporter username="robert@mongodb.com">Robert Stam</reporter>
                        <labels>
                    </labels>
                <created>Thu, 21 Jul 2011 13:50:15 +0000</created>
                <updated>Thu, 2 Apr 2015 18:28:27 +0000</updated>
                            <resolved>Fri, 22 Jul 2011 13:32:26 +0000</resolved>
                                    <version>1.1</version>
                                    <fixVersion>1.2</fixVersion>
                                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="44001" author="rstam" created="Fri, 22 Jul 2011 13:32:20 +0000"  >&lt;p&gt;Not likely we could retire the Save method. All the drivers have one, and we want consistency as much as possible between drivers.&lt;/p&gt;</comment>
                            <comment id="43979" author="nightroman" created="Fri, 22 Jul 2011 07:59:57 +0000"  >&lt;p&gt;Just a thought to consider, not really a suggestion: an alternative might be to retire the whole Save() method set and to introduce an option in some Insert() methods that tells to perform save/upsert. Advantages: this ticket would not exist &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;, less API, less almost duplicated code, and no need in this:&lt;/p&gt;

&lt;p&gt;if (...)&lt;br/&gt;
    collection.Insert(...);&lt;br/&gt;
else&lt;br/&gt;
   collection.Save(...);&lt;/p&gt;

&lt;p&gt;Instead, it might be:&lt;/p&gt;

&lt;p&gt;InsertOptions options = ...;&lt;br/&gt;
options.Save = ...;&lt;br/&gt;
collection.Insert(..., options);&lt;/p&gt;

&lt;p&gt;The second version presumably will have advantages in some scenarios.&lt;/p&gt;

&lt;p&gt;P.S. My PowerShell module (just a few helper cmdlets) follows this idea: it has the Add-Mongo cmdlet with the -Save switch. There is no Save-Mongo spouse there.&lt;/p&gt;</comment>
                            <comment id="43824" author="rstam" created="Thu, 21 Jul 2011 17:14:28 +0000"  >&lt;p&gt;OK, thanks. Now I know why you encountered this. A C# user probably wouldn&apos;t have noticed, but it needs to be addressed nonetheless.&lt;/p&gt;</comment>
                            <comment id="43811" author="nightroman" created="Thu, 21 Jul 2011 16:23:02 +0000"  >&lt;p&gt;Here is the example PowerShell code that shows the issue:&lt;/p&gt;

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

&lt;p&gt;Add-Type -Path MongoDB.Driver.dll&lt;br/&gt;
$server = &lt;span class=&quot;error&quot;&gt;&amp;#91;MongoDB.Driver.MongoServer&amp;#93;&lt;/span&gt;::Create(&quot;mongodb://localhost&quot;)&lt;br/&gt;
$database = $server.GetDatabase(&quot;test&quot;)&lt;br/&gt;
$collection = $database.GetCollection(&quot;test&quot;)&lt;/p&gt;

&lt;p&gt;$doc = New-Object MongoDB.Bson.BsonDocument&lt;br/&gt;
$doc&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;Text&amp;#39;&amp;#93;&lt;/span&gt; = &apos;Hello world&apos;&lt;/p&gt;

&lt;ol&gt;
	&lt;li&gt;works&lt;br/&gt;
$collection.Insert($doc)&lt;/li&gt;
&lt;/ol&gt;


&lt;ol&gt;
	&lt;li&gt;works but this is awkward&lt;br/&gt;
$collection.Save(&lt;span class=&quot;error&quot;&gt;&amp;#91;MongoDB.Bson.BsonDocument&amp;#93;&lt;/span&gt;, $doc)&lt;/li&gt;
&lt;/ol&gt;


&lt;ol&gt;
	&lt;li&gt;fails: Cannot find an overload for &quot;Save&quot; and the argument count: &quot;1&quot;.&lt;br/&gt;
$collection.Save($doc)&lt;/li&gt;
&lt;/ol&gt;


&lt;p&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|hrh8on:</customfieldvalue>

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