<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:08:35 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>[CDRIVER-142] inserted &apos;undefined&apos; field what I didn&apos;t insert while object inserting</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-142</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description>&lt;p&gt;hi, I&apos;m using this library to connect to MongoDb in my project.&lt;br/&gt;
I found strange thing when I insert some object into MongoDb. &lt;br/&gt;
following is my test code and result.&lt;/p&gt;

&lt;p&gt;bson bs;&lt;br/&gt;
bson_init(&amp;amp;bs);&lt;br/&gt;
    bson_append_start_object(&amp;amp;bs, &quot;ObjName&quot;);&lt;br/&gt;
        bson_append_start_array(&amp;amp;bs, &quot;ArrName&quot;);&lt;br/&gt;
            bson_append_start_object(&amp;amp;bs, &quot;1&quot;);&lt;br/&gt;
            bson_append_string(&amp;amp;bs, &quot;str1&quot;, &quot;val1&quot;);&lt;br/&gt;
            bson_append_finish_object(&amp;amp;bs);&lt;br/&gt;
            bson_append_start_object(&amp;amp;bs, &quot;2&quot;);&lt;br/&gt;
            bson_append_string(&amp;amp;bs, &quot;str2&quot;, &quot;val2&quot;);&lt;br/&gt;
            bson_append_finish_object(&amp;amp;bs);&lt;br/&gt;
            bson_append_start_object(&amp;amp;bs, &quot;3&quot;);&lt;br/&gt;
            bson_append_string(&amp;amp;bs, &quot;str3&quot;, &quot;val3&quot;);&lt;br/&gt;
            bson_append_finish_object(&amp;amp;bs);&lt;br/&gt;
        bson_append_finish_array(&amp;amp;bs);&lt;br/&gt;
    bson_append_finish_object(&amp;amp;bs);&lt;br/&gt;
bson_finish(&amp;amp;bs);&lt;br/&gt;
bson_bool_t res = mongo_insert(&lt;br/&gt;
    conn,&lt;br/&gt;
    &quot;MyTestDb.Test1&quot;,&lt;br/&gt;
    &amp;amp;bs&lt;br/&gt;
);&lt;/p&gt;

&lt;p&gt;after success to insert, when I check that data in the mongo shell, &lt;br/&gt;
they returns like following.&lt;/p&gt;

&lt;p&gt;show dbs;&lt;br/&gt;
MyTestDb 0.078125GB&lt;br/&gt;
local (empty)&lt;/p&gt;

&lt;p&gt;use MyTestDb&lt;br/&gt;
switched to db MyTestDb&lt;br/&gt;
show collections;&lt;br/&gt;
Test1&lt;br/&gt;
system.indexes&lt;/p&gt;

&lt;p&gt;db.Test1.findOne();&lt;br/&gt;
{&lt;br/&gt;
&quot;_id&quot; : ObjectId(&quot;4fbee85a1a374e84411c7eb4&quot;),&lt;br/&gt;
&quot;ObjName&quot; : {&lt;br/&gt;
&quot;ArrName&quot; : [&lt;br/&gt;
undefined,&lt;br/&gt;
{&lt;br/&gt;
&quot;str1&quot; : &quot;val1&quot;&lt;br/&gt;
},&lt;br/&gt;
{&lt;br/&gt;
&quot;str2&quot; : &quot;val2&quot;&lt;br/&gt;
},&lt;br/&gt;
{&lt;br/&gt;
&quot;str3&quot; : &quot;val3&quot;&lt;br/&gt;
}&lt;br/&gt;
]&lt;br/&gt;
}&lt;br/&gt;
}&lt;br/&gt;
there is &apos;undefined&apos; field what I didn&apos;t insert.&lt;br/&gt;
if this is already known issue, please let me know.&lt;br/&gt;
I&apos;ll glad to receive any links, reply about this issue.&lt;/p&gt;

&lt;p&gt;thanks!&lt;/p&gt;

&lt;p&gt;-surym&lt;/p&gt;</description>
                <environment>windows, windows 7, 64bit</environment>
        <key id="39590">CDRIVER-142</key>
            <summary>inserted &apos;undefined&apos; field what I didn&apos;t insert while object inserting</summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</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="-1">Unassigned</assignee>
                                    <reporter username="surym">Seunghoon Park</reporter>
                        <labels>
                            <label>driver</label>
                    </labels>
                <created>Fri, 25 May 2012 07:22:19 +0000</created>
                <updated>Wed, 11 Sep 2019 19:05:05 +0000</updated>
                            <resolved>Fri, 25 May 2012 14:32:26 +0000</resolved>
                                    <version>0.4</version>
                                                                        <votes>0</votes>
                                    <watches>0</watches>
                                                                                                                <comments>
                            <comment id="123231" author="kbanker" created="Fri, 25 May 2012 19:00:50 +0000"  >&lt;p&gt;Yes.&lt;/p&gt;</comment>
                            <comment id="123229" author="surym" created="Fri, 25 May 2012 18:56:59 +0000"  >&lt;p&gt;oh, thanks for comments.&lt;br/&gt;
actually, It&apos;s hard to find comments like you in driver header file.&lt;br/&gt;
I just give the name for object to insert more than one object into array, &lt;br/&gt;
however, &lt;br/&gt;
according to your comments, &lt;br/&gt;
I have to give the index as the name of the object in the array.&lt;br/&gt;
am I right?&lt;/p&gt;</comment>
                            <comment id="123101" author="kbanker" created="Fri, 25 May 2012 14:32:17 +0000"  >&lt;p&gt;The issue is that arrays are zero-indexed. So when you call bson_append_start_object(), you must start with &quot;0&quot;, not &quot;1&quot; as you&apos;ve done in your example.&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|hrh6gn:</customfieldvalue>

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