<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:03:03 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>[DOCS-11536] Reverse byte positions match order of bitwise query by positions</title>
                <link>https://jira.mongodb.org/browse/DOCS-11536</link>
                <project id="10380" key="DOCS">Documentation</project>
                    <description>&lt;p&gt;According to the comments in source code, the steps of matching BinData by bitwise query is:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;            // Map to byte position and bit position within that byte. Note that byte positions&lt;br/&gt;
            // start at position 0 in the char array, and bit positions start at the least&lt;br/&gt;
            // significant bit.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;That means, given the documents:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;{ &quot;_id&quot; : 1, &quot;a&quot; : BinData(0, &quot;AAAB&quot;), &quot;binaryValueofA&quot; : &quot;0000 0000 0000 0000 0000 0001&quot; }&lt;/p&gt;&lt;/blockquote&gt;
&lt;blockquote&gt;&lt;p&gt;{ &quot;_id&quot; : 2, &quot;a&quot; : BinData(0, &quot;AQAA&quot;), &quot;binaryValueofA&quot; : &quot;0000 0001 0000 0000 0000 0000&quot; }&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;the query&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;db.collection.find({&quot;a&quot;: {$bitsAnySet: [0]}})&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;matchs&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;{ &quot;_id&quot; : 2, &quot;a&quot; : BinData(0, &quot;AQAA&quot;), &quot;binaryValueofA&quot; : &quot;0000 0001 0000 0000 0000 0000&quot; }&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;and&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;db.collection.find({&quot;a&quot;: {$bitsAnySet: [16]}})&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;matches&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;{ &quot;_id&quot; : 1, &quot;a&quot; : BinData(0, &quot;AAAB&quot;), &quot;binaryValueofA&quot; : &quot;0000 0000 0000 0000 0000 0001&quot; }&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;It&apos;s very counterintuitive and makes bitwise query operators much less useful. This behavior is also not clearly documented in the MongoDB Docs.&lt;br/&gt;
It should be better to keep the byte position order the same as the bit position order.&lt;/p&gt;</description>
                <environment></environment>
        <key id="521054">DOCS-11536</key>
            <summary>Reverse byte positions match order of bitwise query by positions</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="13202">Works as Designed</resolution>
                                        <assignee username="stephen.steneker@mongodb.com">Stennie Steneker</assignee>
                                    <reporter username="sin">Sin</reporter>
                        <labels>
                    </labels>
                <created>Tue, 3 Apr 2018 08:24:18 +0000</created>
                <updated>Mon, 30 Oct 2023 20:59:42 +0000</updated>
                            <resolved>Tue, 3 Apr 2018 12:42:23 +0000</resolved>
                                                    <fixVersion>Server_Docs_20231030</fixVersion>
                                    <component>manual</component>
                        <due></due>
                            <votes>0</votes>
                                    <watches>5</watches>
                                                                                                                <comments>
                            <comment id="1854581" author="sin" created="Wed, 4 Apr 2018 01:54:59 +0000"  >&lt;p&gt;The document only explains the behavior within one byte, but not clearly explains the situation of multiple bytes. E.g., according to the document, we expect the positions like this:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Bit Value	1	1	1	1	1	1	1	1	0&lt;br/&gt;
Position 	&lt;b&gt;8&lt;/b&gt;	7	6	5	4	3	2	1	0&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;However, the actual behavior is:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Bit Value	1	1 	1 	1 	1 	1 	1 	1	0&lt;br/&gt;
Position 	0	15	14	13	12	11	10	9	8&lt;/p&gt;&lt;/blockquote&gt;</comment>
                            <comment id="1853242" author="stennie" created="Tue, 3 Apr 2018 12:41:11 +0000"  >&lt;p&gt;Since BSON types must be &lt;a href=&quot;http://bsonspec.org/spec.html&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;serialized in little endian format&lt;/a&gt;, the least significant bit comparison matches the BSON representation and ensures consistent cross-platform comparison.&lt;/p&gt;

&lt;p&gt;This behaviour is documented for the &lt;a href=&quot;https://docs.mongodb.com/manual/reference/operator/query/bitsAnySet/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;$bitsAnySet query operator&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;b&gt;Position List&lt;/b&gt;&lt;br/&gt;
If querying a list of bit positions, each &amp;lt;position&amp;gt; must be a non-negative integer. Bit positions start at 0 from the least significant bit. For example, the decimal number 254 would have the following bit positions:&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Regards,&lt;br/&gt;
Stennie&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Tue, 3 Apr 2018 12:41:11 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        5 years, 45 weeks, 1 day ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[]]></customfieldvalue>


                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10057" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comment by Customer</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>emet.ozar@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            5 years, 45 weeks, 1 day ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                            <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>sin</customfieldvalue>
            <customfieldvalue>stephen.steneker@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|htu7y7:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|htlgxz:</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>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10053" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>Time In Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|httu6f:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                </customfields>
    </item>
</channel>
</rss>