<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:09: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-468] mongoc_collection_find and logical $and/$or</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-468</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description>&lt;p&gt;When construction a query using BCON_NEW, using the $and or $or operator will fail if there is another expression prior to the use of $and/$or.&lt;/p&gt;

&lt;p&gt;The following query will yield results:&lt;br/&gt;
query = BCON_NEW(&quot;$and&quot;,&quot;[&quot;,&quot;{&quot;,GROUPSTART,&quot;&lt;/p&gt;
{&quot;,&quot;$lte&quot;,BCON_INT32(addr),&quot;}&quot;,&quot;}&quot;,&quot;{&quot;,GROUPSTOP,&quot;{&quot;,&quot;$gte&quot;,BCON_INT32(addr),&quot;}&quot;,&quot;}&quot;,&quot;]&quot;);&lt;br/&gt;
&lt;br/&gt;
The following will NOT yield results:&lt;br/&gt;
 query = BCON_NEW(GROUPAUTO, BCON_BOOL(true),&lt;br/&gt;
                     &quot;$and&quot;,&quot;[&quot;,&quot;{&quot;,GROUPSTART,&quot;{&quot;,&quot;$lte&quot;,BCON_INT32(addr),&quot;}
&lt;p&gt;&quot;,&quot;}&quot;,&quot;{&quot;,GROUPSTOP,&quot;&lt;/p&gt;
{&quot;,&quot;$gte&quot;,BCON_INT32(addr),&quot;}
&lt;p&gt;&quot;,&quot;}&quot;,&quot;]&quot;);&lt;/p&gt;

&lt;p&gt;If I call a bson_as_json on the second query, and use that json to create a raw query from the shell. It WILL yield results.&lt;/p&gt;</description>
                <environment>*nix</environment>
        <key id="170779">CDRIVER-468</key>
            <summary>mongoc_collection_find and logical $and/$or</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="-1">Unassigned</assignee>
                                    <reporter username="myjay610">John Myers</reporter>
                        <labels>
                    </labels>
                <created>Sat, 22 Nov 2014 01:15:51 +0000</created>
                <updated>Wed, 3 May 2017 22:14:53 +0000</updated>
                            <resolved>Tue, 27 Jan 2015 16:31:17 +0000</resolved>
                                    <version>1.1.0</version>
                                                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="802788" author="jason.carey" created="Mon, 12 Jan 2015 20:35:53 +0000"  >&lt;p&gt;Unfortunately the C driver has some overly aggressive validation for queries.&lt;/p&gt;

&lt;p&gt;From the specification for the wire protocol (which find thinly wraps):&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;query&lt;br/&gt;
BSON document that represents the query. The query will contain one or more elements, all of which must match for a document to be included in the result set. Possible elements include $query, $orderby, $hint, $explain, and $snapshot.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Those are all viable top level $-prefixed keys that change the behavior of query.  You can &quot;escape&quot; your query by creating a nested subdocument under a $query key.&lt;/p&gt;

&lt;p&gt;Hope that helps,&lt;br/&gt;
Jason&lt;/p&gt;</comment>
                            <comment id="770534" author="myjay610" created="Sat, 22 Nov 2014 02:12:20 +0000"  >&lt;p&gt;Actually, it looks like combining an $and or $or expression with any other expression, will not work with the C driver.&lt;/p&gt;</comment>
                            <comment id="770520" author="myjay610" created="Sat, 22 Nov 2014 01:19:28 +0000"  >&lt;p&gt;This is the output from the failed C query that does work in the shell:&lt;br/&gt;
{ &quot;auto_add&quot; : true, &quot;$and&quot; : [ { &quot;start_ip_int&quot; : &lt;/p&gt;
{ &quot;$lte&quot; : 168428850 }
&lt;p&gt; }, { &quot;stop_ip_int&quot; : &lt;/p&gt;
{ &quot;$gte&quot; : 168428850 }
&lt;p&gt; } ] }&lt;/p&gt;

&lt;p&gt;I am also aware that I could omit the $and since it is implicit if I just use the three expressions. But I was testing something else and inadvertently found this.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                            <outwardlinks description="duplicates">
                                                        </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|hrf7x3:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1178</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="374">Platform 00 2/20/15</customfieldvalue>

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