<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:51:28 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-81] ObjectId does not follow the BSON ObjectId specification</title>
                <link>https://jira.mongodb.org/browse/JAVA-81</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;The BSON ObjectId specification declares that the ObjectID is a 12-byte value consisting of a 4-byte timestamp, a 3-byte machine id, a 2-byte process id, and a 3-byte counter (&lt;a href=&quot;http://www.mongodb.org/display/DOCS/Object+IDs&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://www.mongodb.org/display/DOCS/Object+IDs&lt;/a&gt;)&lt;br/&gt;
The Java ObjectId constructors treat the 12-byte buffer as 3 4-bite integers - time, machine, inc. The 2-byte process id is not taken into consideration.&lt;br/&gt;
While time is initialized correctly, the other two values are wrong. This is especially critical for the compareTo method which fails in cases where the two ObjectId timestamps are equal and the inc part is used for comparison.&lt;/p&gt;</description>
                <environment></environment>
        <key id="11193">JAVA-81</key>
            <summary>ObjectId does not follow the BSON ObjectId specification</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="2" iconUrl="https://jira.mongodb.org/images/icons/priorities/critical.svg">Critical - P2</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="eliot">Eliot Horowitz</assignee>
                                    <reporter username="drorbr">Dror Bereznitsky</reporter>
                        <labels>
                    </labels>
                <created>Tue, 26 Jan 2010 06:57:41 +0000</created>
                <updated>Mon, 1 Mar 2010 23:02:42 +0000</updated>
                            <resolved>Tue, 26 Jan 2010 10:06:15 +0000</resolved>
                                    <version>1.2</version>
                                                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="12017" author="drorbr" created="Wed, 27 Jan 2010 02:56:04 +0000"  >&lt;p&gt;1) I would like to be able to get all the 4 parts of the ObjectId - timestamp, machine, process id and inc. Right now ObjectId already have getMachine(), getTime(), getInc() but getMachine() and getInc() returns incorrect values (when ObjectId is initialized from a String).&lt;br/&gt;
2) I would the compareTo method to behave as MongoDB behaves when it compares two ObjectIds. &lt;br/&gt;
    Currently I have an issue where I query MongoDB for a set of documents sorted by their ObjectId and get a certain order, but if I sort the same set of documents using the ObjectId.compareTo() method I get another order.&lt;/p&gt;</comment>
                            <comment id="11979" author="eliot" created="Tue, 26 Jan 2010 11:25:07 +0000"  >&lt;p&gt;how its stored internally doesn&apos;t really matter.&lt;/p&gt;

&lt;p&gt;do you mean the getMachine() method&lt;/p&gt;

&lt;p&gt;are you saying you want a &lt;br/&gt;
getMachineCode()&lt;br/&gt;
getProcessCode()&lt;br/&gt;
etc?&lt;/p&gt;</comment>
                            <comment id="11978" author="drorbr" created="Tue, 26 Jan 2010 11:22:33 +0000"  >&lt;p&gt;I was referring to a scenario where I am creating an ObjectId from its String representation. &lt;br/&gt;
For example:&lt;/p&gt;

&lt;p&gt;  ObjectId id = new ObjectId(&quot;49902cde5162504500b45c2c&quot;);&lt;/p&gt;

&lt;p&gt;It this case the following code from the constructor is incorrect since it disregards the process id:&lt;/p&gt;

&lt;p&gt;  _inc = bb.getInt();&lt;br/&gt;
  _machine = bb.getInt();&lt;br/&gt;
  _time = bb.getInt();&lt;/p&gt;

&lt;p&gt;Asking for the &quot;inc&quot; or &quot;machine&quot; parts of the ObjectId will return wrong values.&lt;/p&gt;</comment>
                            <comment id="11968" author="eliot" created="Tue, 26 Jan 2010 10:06:15 +0000"  >&lt;p&gt;Look at the static initializer around line 314.&lt;/p&gt;

&lt;p&gt;it gets the machine and the process&lt;/p&gt;

&lt;p&gt;        final int machinePiece;&lt;br/&gt;
            {&lt;br/&gt;
                StringBuilder sb = new StringBuilder();&lt;br/&gt;
                Enumeration&amp;lt;NetworkInterface&amp;gt; e = NetworkInterface.getNetworkInterfaces();&lt;br/&gt;
                while ( e.hasMoreElements() )&lt;/p&gt;
{
                    NetworkInterface ni = e.nextElement();
                    sb.append( ni.toString() );
                }
&lt;p&gt;                machinePiece = sb.toString().hashCode() &amp;lt;&amp;lt; 16;&lt;br/&gt;
                if ( D ) System.out.println( &quot;machine piece post: &quot; + Integer.toHexString( machinePiece ) );&lt;br/&gt;
            }&lt;/p&gt;

&lt;p&gt;            final int processPiece = java.lang.management.ManagementFactory.getRuntimeMXBean().getName().hashCode() &amp;amp; 0xFFFF;&lt;br/&gt;
            if ( D ) System.out.println( &quot;process piece: &quot; + Integer.toHexString( processPiece ) );&lt;/p&gt;

&lt;p&gt;            _genmachine = machinePiece | processPiece;&lt;br/&gt;
            if ( D ) System.out.println( &quot;machine : &quot; + Integer.toHexString( _genmachine ) );&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|hrhdbz:</customfieldvalue>

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