<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:36:40 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-388] Duplicate element name &apos;cause&apos; when map reducing</title>
                <link>https://jira.mongodb.org/browse/CSHARP-388</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;When mapreducing, a strange error appear sometimes. Here is the stacktrace : &lt;br/&gt;
System.InvalidOperationException: Duplicate element name &apos;cause&apos;. at MongoDB.Bson.BsonDocument.Add(BsonElement element) in C:\work\10gen\mongodb\mongo-csharp-driver\Bson\ObjectModel\BsonDocument.cs:line 453 &lt;br/&gt;
at MongoDB.Bson.BsonDocument.Deserialize(BsonReader bsonReader, Type nominalType, IBsonSerializationOptions options) in C:\work\10gen\mongodb\mongo-csharp-driver\Bson\ObjectModel\BsonDocument.cs:line 720 &lt;br/&gt;
at MongoDB.Bson.BsonDocument.ReadFrom(BsonReader bsonReader) in C:\work\10gen\mongodb\mongo-csharp-driver\Bson\ObjectModel\BsonDocument.cs:line 393 &lt;br/&gt;
at MongoDB.Bson.Serialization.BsonSerializer.Deserialize(BsonReader bsonReader, Type nominalType, IBsonSerializationOptions options) in C:\work\10gen\mongodb\mongo-csharp-driver\Bson\Serialization\BsonSerializer.cs:line 214 &lt;br/&gt;
at MongoDB.Driver.Internal.MongoReplyMessage`1.ReadFrom(BsonBuffer buffer, IBsonSerializationOptions serializationOptions) in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Internal\MongoReplyMessage.cs:line 94 &lt;br/&gt;
at MongoDB.Driver.Internal.MongoConnection.ReceiveMessage&lt;span class=&quot;error&quot;&gt;&amp;#91;TDocument&amp;#93;&lt;/span&gt;(BsonBinaryReaderSettings readerSettings, IBsonSerializationOptions serializationOptions) in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Internal\MongoConnection.cs:line 386 &lt;br/&gt;
at MongoDB.Driver.MongoCursorEnumerator`1.GetReply(MongoConnection connection, MongoRequestMessage message) in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Core\MongoCursorEnumerator.cs:line 263 &lt;br/&gt;
at MongoDB.Driver.MongoCursorEnumerator`1.GetFirst() in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Core\MongoCursorEnumerator.cs:line 223 &lt;br/&gt;
at MongoDB.Driver.MongoCursorEnumerator`1.MoveNext() in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Core\MongoCursorEnumerator.cs:line 126 &lt;br/&gt;
at System.Linq.Enumerable.FirstOrDefault&lt;span class=&quot;error&quot;&gt;&amp;#91;TSource&amp;#93;&lt;/span&gt;(IEnumerable`1 source) at MongoDB.Driver.MongoCollection.FindOneAs&lt;span class=&quot;error&quot;&gt;&amp;#91;TDocument&amp;#93;&lt;/span&gt;(IMongoQuery query) in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Core\MongoCollection.cs:line 498 at MongoDB.Driver.MongoCollection`1.FindOne(IMongoQuery query) in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Core\MongoCollection.cs:line 1639 at MongoDB.Driver.MongoDatabase.RunCommandAs(Type commandResultType, IMongoCommand command) in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Core\MongoDatabase.cs:line 891 &lt;br/&gt;
at MongoDB.Driver.MongoDatabase.RunCommandAs&lt;span class=&quot;error&quot;&gt;&amp;#91;TCommandResult&amp;#93;&lt;/span&gt;(IMongoCommand command) in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Core\MongoDatabase.cs:line 866 &lt;br/&gt;
at MongoDB.Driver.MongoCollection.MapReduce(BsonJavaScript map, BsonJavaScript reduce, IMongoMapReduceOptions options) in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Core\MongoCollection.cs:line 1106 at MongoDB.Driver.MongoCollection.MapReduce(IMongoQuery query, BsonJavaScript map, BsonJavaScript reduce, IMongoMapReduceOptions options) in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Core\MongoCollection.cs:line 1127 &lt;/p&gt;


&lt;p&gt;I think this due to the driver incapicity to add several times the same field to a bsondocument.&lt;/p&gt;</description>
                <environment>windows</environment>
        <key id="30064">CSHARP-388</key>
            <summary>Duplicate element name &apos;cause&apos; when map reducing</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="9">Done</resolution>
                                        <assignee username="robert@mongodb.com">Robert Stam</assignee>
                                    <reporter username="kamaradclimber">Gr&#233;goire Seux</reporter>
                        <labels>
                            <label>mapreduce</label>
                    </labels>
                <created>Tue, 7 Feb 2012 08:09:47 +0000</created>
                <updated>Thu, 2 Apr 2015 18:27:53 +0000</updated>
                            <resolved>Thu, 1 Mar 2012 04:50:37 +0000</resolved>
                                    <version>1.3.1</version>
                                    <fixVersion>1.4</fixVersion>
                                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="94057" author="kamaradclimber" created="Thu, 1 Mar 2012 08:08:52 +0000"  >&lt;p&gt;ok thanks&lt;/p&gt;</comment>
                            <comment id="94037" author="rstam" created="Thu, 1 Mar 2012 04:50:25 +0000"  >&lt;p&gt;Since the implementation of &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-404&quot; title=&quot;Do not throw exception on dup fields during decoding&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-404&quot;&gt;&lt;del&gt;CSHARP-404&lt;/del&gt;&lt;/a&gt; now allows BsonDocuments returned from the server to contain duplicate names, this should no longer be an issue even if the server does return more than one instance of the &quot;cause&quot; element.&lt;/p&gt;

&lt;p&gt;Therefore I won&apos;t try to reproduce this anymore.&lt;/p&gt;</comment>
                            <comment id="92768" author="kamaradclimber" created="Mon, 27 Feb 2012 14:17:39 +0000"  >&lt;p&gt;An example of data is :&lt;br/&gt;
{&lt;br/&gt;
        &quot;_id&quot; : BinData(0,&quot;YS5tp2cGAAAzMDg5Mw==&quot;),&lt;br/&gt;
        &quot;category&quot; : [&lt;/p&gt;
                {
                        &quot;h&quot; : 1110547694,
                        &quot;colTp&quot; : 1,
                        &quot;catName&quot; : &quot;Librairie &amp;gt; Livres &amp;gt; Street Art&quot;,
                        &quot;catType&quot; : &quot;NONE&quot;
                }
&lt;p&gt;        ],&lt;br/&gt;
        &quot;price&quot; : 99.99&lt;br/&gt;
        &quot;lastTouch&quot; : ISODate(&quot;2012-02-27T12:59:30.155Z&quot;),&lt;br/&gt;
        &quot;partnerId&quot; : 1639,&lt;br/&gt;
}&lt;/p&gt;</comment>
                            <comment id="92767" author="kamaradclimber" created="Mon, 27 Feb 2012 14:15:30 +0000"  >&lt;p&gt;map = function() {&lt;br/&gt;
    if (this.category !=null &amp;amp;&amp;amp; this.recommendable != false) {&lt;br/&gt;
        product = this;&lt;br/&gt;
        this.category.forEach(function(value) {&lt;br/&gt;
                emit(&lt;/p&gt;
{colTp:value.colTp, h:value.h, lT: [A DATE], name:value.catName, partnerId : product.partnerId}
&lt;p&gt;, &lt;/p&gt;
{ sp :product.price, nbprod :1}
&lt;p&gt;);&lt;br/&gt;
                })&lt;br/&gt;
    }&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;reduce = function(key,values) &lt;/p&gt;
{
    var result = sp : 0, nbprod:0}
&lt;p&gt;;&lt;br/&gt;
    values.forEach(function(value) &lt;/p&gt;
{
            result.sp += value.sp;
            result.nbprod += value.nbprod;
            }
&lt;p&gt;);&lt;br/&gt;
    return result;&lt;br/&gt;
}&lt;/p&gt;</comment>
                            <comment id="88107" author="rstam" created="Tue, 14 Feb 2012 01:33:32 +0000"  >&lt;p&gt;Can you provide some sample data and the map/reduce functions needed to reproduce this?&lt;/p&gt;

&lt;p&gt;I&apos;m surprised the server allows you to create a document with duplicate field names (since JavaScript doesn&apos;t support that).&lt;/p&gt;

&lt;p&gt;You are correct that the C# driver doesn&apos;t allow it.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="31246">CSHARP-404</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <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|hrh80n:</customfieldvalue>

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