<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 02:53:53 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>[SERVER-377] Partial matching for sub objects</title>
                <link>https://jira.mongodb.org/browse/SERVER-377</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;There ought to be a way to partially match sub objects&lt;/p&gt;

&lt;p&gt;Let&apos;s say you want to match this record:{a:[&lt;/p&gt;
{b:1,c:2,d:4}
&lt;p&gt;,&lt;/p&gt;
{b:2,c:3,d:5}
&lt;p&gt;]}&lt;/p&gt;

&lt;p&gt;There is no simple way to partially map one of the objects that belongs to &apos;a&apos;.  If you do find({a:{b:1,c:2}}) currently, it will fail since sub objects must match exactly.&lt;/p&gt;

&lt;p&gt;There are few work arounds:&lt;/p&gt;

&lt;p&gt;You can match the sub object exactly, for example find({a:{b:1,c:2,d:4}}).  This is far from ideal, because it means you have to know the format of your data before hand, which completely defeats the purpose of using a schemaless database.&lt;/p&gt;

&lt;p&gt;You can use dot notation instead of a subobject, for example match against find(&lt;/p&gt;
{&apos;a.b&apos;:1,&apos;a.c&apos;:2}
&lt;p&gt;).  This will work, but it will also return incorrect results, for example find(&lt;/p&gt;
{&apos;a.b&apos;:1,&apos;a.c&apos;:3}
&lt;p&gt;) will also match our document.&lt;/p&gt;

&lt;p&gt;You can use a javascript function.  This will return correct results, but It&apos;s also orders of magnitude slower in large collections, and requires maintaining the project in multiple languages.  This approach also introduces an additional level of complexity that seems needless.&lt;/p&gt;

&lt;p&gt;You can combine the second and third work arounds to fix incorrect results, but it&apos;s still difficult to maintain.  You can also check the results of the the second method in your project&apos;s language, which eliminates the problem of having to generate javascript, but still seems overly complex.&lt;/p&gt;

&lt;p&gt;Ideally you could partially match sub objects by use of a conditional operator something like this: find({a:{$partial_match:&lt;/p&gt;
{b:1,c:2}
&lt;p&gt;}})&lt;/p&gt;</description>
                <environment>Any</environment>
        <key id="10786">SERVER-377</key>
            <summary>Partial matching for sub objects</summary>
                <type id="2" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14711&amp;avatarType=issuetype">New Feature</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="eliot">Eliot Horowitz</assignee>
                                    <reporter username="zgavin">Zachary Gavin</reporter>
                        <labels>
                    </labels>
                <created>Wed, 21 Oct 2009 12:35:22 +0000</created>
                <updated>Tue, 12 Jul 2016 00:27:52 +0000</updated>
                            <resolved>Thu, 31 Dec 2009 14:30:48 +0000</resolved>
                                                    <fixVersion>1.3.1</fixVersion>
                                    <component>Querying</component>
                                        <votes>17</votes>
                                    <watches>9</watches>
                                                                                                                <comments>
                            <comment id="11888" author="chx" created="Thu, 21 Jan 2010 09:56:29 +0000"  >&lt;p&gt;Thanks! Note that if the alternative storage option gets implemented which I mentioned also would be fine. And then a query like  {$exists: X : { &apos;primary.tag.und.tid.X&apos;: 61, &apos;primary.tag.und..fid.X&apos;: 1 }} would do the trick (declarative programming FTW). If primary.tag.und.tid (and fid) is indexed then this should be a fairly quick operation isnt it? grab the possible indexes, intersect, done?&lt;/p&gt;</comment>
                            <comment id="11887" author="eliot" created="Thu, 21 Jan 2010 09:39:04 +0000"  >&lt;p&gt;I see - that&apos;s not possible right now.&lt;br/&gt;
added a new case: &lt;a href=&quot;http://jira.mongodb.org/browse/SERVER-562&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;http://jira.mongodb.org/browse/SERVER-562&lt;/a&gt;&lt;br/&gt;
please comment there with any questions and importance level&lt;/p&gt;</comment>
                            <comment id="11886" author="chx" created="Thu, 21 Jan 2010 09:34:31 +0000"  >&lt;p&gt;Eliot, please see the structure earlier... Or, here is a simpler example:&lt;/p&gt;

&lt;p&gt;Two documents:&lt;/p&gt;

&lt;p&gt;{primary_tag: &lt;/p&gt;
{ und: [
{  tid: 61,}
&lt;p&gt;,&lt;/p&gt;
{  tid: 62,}
{  tid: 63,}
&lt;p&gt;]}}&lt;/p&gt;

&lt;p&gt;{primary_tag: &lt;/p&gt;
{ und: [
{  tid: 61,}
&lt;p&gt;,&lt;/p&gt;
{  tid: 2,}
{  tid: 3,}
&lt;p&gt;]}}&lt;/p&gt;

&lt;p&gt;I need documents which have both tid 61 and 62. &lt;/p&gt;

&lt;p&gt;Of course, I could store {primary_tag: { und : &lt;/p&gt;
{ tid : [61,62,63 ]}
&lt;p&gt;}} this way and use the $all operator. But then very soon we get back to the original issue with &lt;/p&gt;

&lt;p&gt; {primary_tag: { und : &lt;/p&gt;
{ tid : [61,62,63 ], fid: [1,2,3] }
&lt;p&gt;}}&lt;/p&gt;

&lt;p&gt;wherein I need primary.tag.und..tid.X: 61, primary.tag.und..fid.X: 1 for the same X...&lt;/p&gt;</comment>
                            <comment id="11885" author="eliot" created="Thu, 21 Jan 2010 09:15:00 +0000"  >&lt;p&gt;@karoly Can you provide an example?  I don&apos;t understand the question.&lt;/p&gt;</comment>
                            <comment id="11884" author="chx" created="Thu, 21 Jan 2010 09:11:13 +0000"  >&lt;p&gt;What if I wanted to query such objects that have both value: body1 and value: body2 ?&lt;/p&gt;</comment>
                            <comment id="11575" author="eliot" created="Thu, 31 Dec 2009 14:34:26 +0000"  >&lt;p&gt;Note: if you have&lt;br/&gt;
{ a : [ &lt;/p&gt;
{ x : 1 }
&lt;p&gt; ] }&lt;br/&gt;
and you do a query like&lt;br/&gt;
{ a : { $elemMatch : { x : &lt;/p&gt;
{ $gt : 1 }
&lt;p&gt; } } }&lt;br/&gt;
if you index on &quot;a.x&quot; the index will be used.&lt;/p&gt;</comment>
                            <comment id="11574" author="eliot" created="Thu, 31 Dec 2009 14:31:47 +0000"  >&lt;p&gt;See: &lt;a href=&quot;http://github.com/mongodb/mongo/blob/master/jstests/arrayfind1.js&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://github.com/mongodb/mongo/blob/master/jstests/arrayfind1.js&lt;/a&gt; for examples.&lt;br/&gt;
Current name is $elemMatch, but may change until 1.3.1 is released&lt;/p&gt;</comment>
                            <comment id="11573" author="auto" created="Thu, 31 Dec 2009 14:30:37 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Eliot Horowitz&apos;, &apos;email&apos;: &apos;eliot@10gen.com&apos;}
&lt;p&gt;Message: query optimizer support for $elemMatch &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-377&quot; title=&quot;Partial matching for sub objects&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-377&quot;&gt;&lt;del&gt;SERVER-377&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href=&quot;http://github.com/mongodb/mongo/commit/0a3e1071cb4bb91d1c9c6cb36cac3a0337a97230&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://github.com/mongodb/mongo/commit/0a3e1071cb4bb91d1c9c6cb36cac3a0337a97230&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="11572" author="auto" created="Thu, 31 Dec 2009 14:30:36 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Eliot Horowitz&apos;, &apos;email&apos;: &apos;eliot@10gen.com&apos;}
&lt;p&gt;Message: basics os array element matching done &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-377&quot; title=&quot;Partial matching for sub objects&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-377&quot;&gt;&lt;del&gt;SERVER-377&lt;/del&gt;&lt;/a&gt; - doesn&apos;t work with query optimizer yet&lt;br/&gt;
&lt;a href=&quot;http://github.com/mongodb/mongo/commit/c9de787f171db9abdfe9f580c7fc043b7806a1a4&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://github.com/mongodb/mongo/commit/c9de787f171db9abdfe9f580c7fc043b7806a1a4&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="11410" author="chx" created="Thu, 17 Dec 2009 19:29:14 +0000"  >&lt;p&gt;Drupal 7 field API would &lt;em&gt;love&lt;/em&gt; this feature! We are storing fields like&lt;/p&gt;

&lt;p&gt;&quot;body&quot; : { &quot;zxx&quot; : [&lt;br/&gt;
        &lt;/p&gt;
{
                &quot;summary&quot; : &quot;&quot;,
                &quot;value&quot; : &quot;body1&quot;,
                &quot;format&quot; : &quot;1&quot;,
                &quot;value_format&quot; : &quot;1&quot;
        }
&lt;p&gt;,&lt;br/&gt;
        &lt;/p&gt;
{
                &quot;summary&quot; : &quot;&quot;,
                &quot;value&quot; : &quot;body2&quot;,
                &quot;format&quot; : &quot;2&quot;,
                &quot;value_format&quot; : &quot;1&quot;
        }
&lt;p&gt;,&lt;/p&gt;
        {
                &quot;summary&quot; : &quot;&quot;,
                &quot;value&quot; : &quot;body3&quot;,
                &quot;format&quot; : &quot;1&quot;,
                &quot;value_format&quot; : &quot;1&quot;
        }
&lt;p&gt;] }&lt;/p&gt;

&lt;p&gt;(zxx is ISO 639 for no language) and currently it&apos;s not possible to run a query which grabs value:body:2 format:2. If this would be possible then MongoDB would be a natural choice for Drupal 7 field storage. It works currently but we need to store separately for querying and it becomes ugly (and slower than necessary). &lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                        <issuelink>
            <issuekey id="11037">SERVER-505</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>10.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Thu, 17 Dec 2009 19:29:14 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        14 years, 4 weeks, 6 days 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>ramon.fernandez@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            14 years, 4 weeks, 6 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>auto</customfieldvalue>
            <customfieldvalue>eliot</customfieldvalue>
            <customfieldvalue>chx</customfieldvalue>
            <customfieldvalue>zgavin</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrpv6n:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hriltr:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>22188</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_23361" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Requested By</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10053" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>Time In Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_22870" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Triagers</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrm6jb:</customfieldvalue>

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