<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:58:26 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>[JAVA-2946] I have Question regarding saving java object in mongoDB and getting  mongo Id back</title>
                <link>https://jira.mongodb.org/browse/JAVA-2946</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;Hi Team ,&#160;&lt;/p&gt;

&lt;p&gt;I saving my java object to mongo DB using proper codec and able to save object in mongo&lt;/p&gt;

&lt;p&gt;i am using&#160;collection.insertOne(javaObject);&lt;/p&gt;

&lt;p&gt;i have &lt;b&gt;@BsonId ObjectId id&lt;/b&gt; in my class . when i save object to database i don&apos;t see database generated id reflecting in&#160; &lt;b&gt;ObjectId id (i see this is as null , even after saving object to DB)&lt;/b&gt; field of my class .&lt;/p&gt;

&lt;p&gt;to get this DB generated Id so i have to query mongo Db one more time or there is some other way to do so ?&lt;/p&gt;

&lt;p&gt;Could you please help with above .&lt;/p&gt;

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

&lt;p&gt;Thanks..!&lt;/p&gt;

&lt;p&gt;Aniket&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</description>
                <environment>i am using java 1.8 and mongo java Driver version 3.6</environment>
        <key id="596135">JAVA-2946</key>
            <summary>I have Question regarding saving java object in mongoDB and getting  mongo Id back</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="3">Duplicate</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="aniket20365@gmail.com">Aniket M</reporter>
                        <labels>
                    </labels>
                <created>Tue, 28 Aug 2018 18:24:11 +0000</created>
                <updated>Wed, 11 Sep 2019 19:13:52 +0000</updated>
                            <resolved>Wed, 29 Aug 2018 09:39:32 +0000</resolved>
                                    <version>3.6.0</version>
                                                    <component>API</component>
                    <component>BSON</component>
                    <component>Codecs</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="1988575" author="ross@10gen.com" created="Wed, 29 Aug 2018 09:39:08 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=aniket20365%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;aniket20365@gmail.com&quot;&gt;aniket20365@gmail.com&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;I&apos;m marking this ticket as a duplicate of &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-2674&quot; title=&quot;POJO ID property is not populated after insert&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-2674&quot;&gt;&lt;del&gt;JAVA-2674&lt;/del&gt;&lt;/a&gt;. In short you will need to generate the _id for the object that you are saving.  Please watch that ticket for future updates.&lt;/p&gt;

&lt;p&gt;Ross&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                            <outwardlinks description="duplicates">
                                        <issuelink>
            <issuekey id="463462">JAVA-2674</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|htx387:</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>