<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 02:56:30 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-1248] Should have an $* array-key-wildcard operator</title>
                <link>https://jira.mongodb.org/browse/SERVER-1248</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;As far as I can tell there is no way to find an object containing a value in a subarray if you do not know the exact array-key path, so if the following were a collection of orders you cannot find all orders by unit ID without modifying the schema:&lt;/p&gt;

&lt;p&gt;array(&lt;br/&gt;
&apos;_id&apos; =&amp;gt; 213,&lt;br/&gt;
&apos;units&apos; = array(&lt;br/&gt;
  0 =&amp;gt; array(&apos;id&apos; =&amp;gt; 5, &apos;color&apos; =&amp;gt; &apos;red&apos;),&lt;br/&gt;
  1 =&amp;gt; array(&apos;id&apos; =&amp;gt; 3, &apos;color&apos; =&amp;gt; &apos;blue&apos;),&lt;br/&gt;
  2 =&amp;gt; array(&apos;id&apos; =&amp;gt; 8, &apos;color&apos; =&amp;gt; &apos;polka dot&apos;),&lt;br/&gt;
  3 =&amp;gt; array(&apos;id&apos; =&amp;gt; 9, &apos;color&apos; =&amp;gt; &apos;green&apos;)&lt;br/&gt;
)&lt;br/&gt;
);&lt;/p&gt;

&lt;p&gt;array(&lt;br/&gt;
&apos;_id&apos; =&amp;gt; 456,&lt;br/&gt;
&apos;units&apos; = array(&lt;br/&gt;
  0 =&amp;gt; array(&apos;id&apos; =&amp;gt; 8, &apos;color&apos; =&amp;gt; &apos;purple&apos;),&lt;br/&gt;
  1 =&amp;gt; array(&apos;id&apos; =&amp;gt; 2, &apos;color&apos; =&amp;gt; &apos;yellow&apos;)&lt;br/&gt;
)&lt;br/&gt;
);&lt;/p&gt;

&lt;p&gt;We should be able to do something like:&lt;/p&gt;

&lt;p&gt;$find = array(&apos;units.$*.id&apos; =&amp;gt; 8);&lt;br/&gt;
$col-&amp;gt;find($find);&lt;/p&gt;

&lt;p&gt;Assuming $* would be a wildcard operator that covers any key within the array&lt;/p&gt;</description>
                <environment></environment>
        <key id="12174">SERVER-1248</key>
            <summary>Should have an $* array-key-wildcard operator</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</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="phpmoadmin">phpMoAdmin</reporter>
                        <labels>
                    </labels>
                <created>Thu, 17 Jun 2010 12:55:02 +0000</created>
                <updated>Fri, 15 Feb 2013 15:06:21 +0000</updated>
                            <resolved>Wed, 26 Sep 2012 16:07:25 +0000</resolved>
                                                                                        <votes>9</votes>
                                    <watches>14</watches>
                                                                                                                <comments>
                            <comment id="168302" author="scotthernandez" created="Wed, 26 Sep 2012 16:07:25 +0000"  >&lt;p&gt;This seems to be a dup of &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-267&quot; title=&quot;Wildcard support in index/query/projection&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-267&quot;&gt;SERVER-267&lt;/a&gt;. Please let us know otherwise.&lt;/p&gt;</comment>
                            <comment id="105657" author="glenn" created="Mon, 2 Apr 2012 13:50:28 +0000"  >&lt;p&gt;This is really requesting a feature for searching documents and doesn&apos;t have anything to do with arrays.  I think the OP was confused because PHP conflates key/value dictionaries and arrays, which is confusing for people whose first language is PHP.&lt;/p&gt;

&lt;p&gt;This has parallels with multikey searching for arrays.&lt;/p&gt;

&lt;p&gt;See also &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-5463&quot; title=&quot;Indexing for document keys&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-5463&quot;&gt;&lt;del&gt;SERVER-5463&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="64365" author="lunakid" created="Wed, 2 Nov 2011 23:08:45 +0000"  >&lt;p&gt;Yet another use case (a taxonomy &quot;poly-tree&quot;).&lt;/p&gt;

&lt;p&gt;Currently it&apos;s implemented as:&lt;/p&gt;

&lt;p&gt;taxon: &lt;/p&gt;
{ &apos;parent&apos;: &apos;taxon0&apos; }
&lt;p&gt; // when all sources agree&lt;br/&gt;
or &lt;br/&gt;
taxon: { &apos;parent&apos;: &lt;/p&gt;
{ &apos;source1&apos;: &apos;taxon1&apos;, &apos;source2&apos;: &apos;taxon2&apos; }
&lt;p&gt; } // when sources disagree&lt;/p&gt;

&lt;p&gt;But, alas, I can&apos;t seem to just get &apos;taxon1&apos; and/or &apos;taxon2&apos; regardless of source (1 or 2) in MongoDB.&lt;/p&gt;

&lt;p&gt;Instead, I fear I might need to change the data model to:&lt;/p&gt;

&lt;p&gt;taxon: { &apos;parent&apos; {&lt;br/&gt;
		&lt;/p&gt;
{ &apos;source&apos;: &apos;source1&apos;, &apos;parent&apos; =&amp;gt; &apos;taxon1&apos; }
&lt;p&gt;,&lt;/p&gt;
		{ &apos;source&apos;: &apos;source2&apos;, &apos;parent&apos; =&amp;gt; &apos;taxon2&apos; }
&lt;p&gt;	}&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;which would not only be less sexy, but would mean lots of code changes, too, and would also put MongoDB to the &quot;syntactic bottleneck&quot; role instead of PHP.&lt;/p&gt;</comment>
                            <comment id="26841" author="jshanks" created="Fri, 25 Mar 2011 17:55:17 +0000"  >&lt;p&gt;For my example, our objects in our content collection look like this:&lt;br/&gt;
_id: 12345678,&lt;br/&gt;
channels: {&lt;br/&gt;
   print_issue: {&lt;br/&gt;
      string_identifierA: &lt;/p&gt;
{
         channel: &apos;MAR11&apos;,
         section: &apos;new_products&apos;,
         ...
      }
&lt;p&gt;,&lt;br/&gt;
      string_identifierB: &lt;/p&gt;
{
         channel: &apos;APR11&apos;,
         section: &apos;new_products&apos;,
         ...
      }
&lt;p&gt;   }&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;I would like to query it like this &lt;/p&gt;

&lt;p&gt;db.content.find(&lt;/p&gt;
{&apos;channels.print_issue.$.channel&apos;: &apos;MAR11&apos;}
&lt;p&gt;);&lt;/p&gt;

&lt;p&gt;I do realize if I took the &apos;string_identifier&apos; out as the key of the object, put it into the sub object, and changed &apos;print_issue&apos; to a normal array, that I could do a query like this:&lt;/p&gt;

&lt;p&gt;db.content.find(&lt;/p&gt;
{&apos;channels.print_issue.channel&apos;: &apos;MAR11&apos;}
&lt;p&gt;);&lt;/p&gt;

&lt;p&gt;But I&apos;d prefer to not modify my object format just for mongo inserts since the object format is used in the same way over multiple applications/api&apos;s as I&apos;m sure is the case for many people who want or expect this functionality when considering mongo.&lt;/p&gt;</comment>
                            <comment id="21804" author="phpmoadmin" created="Sun, 26 Dec 2010 04:26:22 +0000"  >&lt;p&gt;Hi Benjamin,&lt;/p&gt;

&lt;p&gt;If your subkeys are consistent (they are always &quot;text&quot;) then you can just skip the definition of the preceding variable-keys:&lt;/p&gt;

&lt;p&gt;find(&lt;/p&gt;
{ &quot;log.msg.text&quot;: ........ }

&lt;p&gt;The issue in this ticket only applies if your subkey&apos;s vary and cannot be defined in the query.&lt;/p&gt;</comment>
                            <comment id="21803" author="benmen" created="Sat, 25 Dec 2010 20:25:30 +0000"  >&lt;p&gt;I have a similar problem.&lt;br/&gt;
My database looks like&lt;br/&gt;
{&lt;br/&gt;
     &quot;log&quot;: {&lt;br/&gt;
       &quot;0&quot;: {&lt;br/&gt;
         &quot;msg&quot;: &lt;/p&gt;
{
           &quot;text&quot;: &quot;text1)&quot; 
        }
&lt;p&gt; &lt;br/&gt;
      },&lt;br/&gt;
       &quot;1&quot;: {&lt;br/&gt;
         &quot;msg&quot;: &lt;/p&gt;
{
           &quot;text&quot;: &quot;text2&quot; 
        }
&lt;p&gt; &lt;br/&gt;
      }&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;I want to make a query on &quot;text&quot; for every msg in the array by using regexps (i need it that way). I tried:&lt;br/&gt;
find({$where:&quot;/^text/.test(this.log.msg.text)&quot;})&lt;br/&gt;
which doesnt work.&lt;br/&gt;
Is there any solution for this?&lt;br/&gt;
BTW: this was tested using the mongoconsole front-end.&lt;/p&gt;

&lt;p&gt;regards,&lt;br/&gt;
Benjamin&lt;/p&gt;</comment>
                            <comment id="19873" author="bugslayer" created="Sat, 30 Oct 2010 21:19:23 +0000"  >&lt;p&gt;I sort of expected to be able to do something similar, except I expected to be able to use the $ operator here. I.E. units.$.id.&lt;/p&gt;

&lt;p&gt;In some respects, this is less of a request for new functionality, and more of a request for a more logical and memorable syntax for querying arrays.&lt;/p&gt;

&lt;p&gt;If $elemMatch were enhanced to work with objects, the $ operator could be used as shorthand for $elemMatch, and would also work for objects (which is what you have in the timestamp case shown).&lt;/p&gt;

&lt;p&gt;Extending $elemMatch would additionally help alleviate some of the issues with arrays and PHP (it&apos;s too easy to accidentally break the numbering, resulting in an &quot;object&quot; being stored where an &quot;array&quot; is expected, and some operations stop working.) It appears that the discrepancy between &quot;arrays&quot; and &quot;objects&quot; (especially for PHP) may actually be at the root of this request, and blurring the lines so that it doesn&apos;t matter so much may fix the real need here.&lt;/p&gt;</comment>
                            <comment id="14876" author="phpmoadmin" created="Fri, 18 Jun 2010 18:57:23 +0000"  >&lt;p&gt;Karoly, you are in-fact correct for the example that I posted, but the issue still exists for an array without any identifiable subkey. &lt;/p&gt;

&lt;p&gt;In the next schema example, how would you search for a document with the &quot;blueScarf.jpg&quot; image if the arraykey is an unknown timestamp?&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;_id&amp;#93;&lt;/span&gt; =&amp;gt; 1&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;img&amp;#93;&lt;/span&gt; =&amp;gt; Array (&lt;br/&gt;
    &lt;span class=&quot;error&quot;&gt;&amp;#91;1276297762&amp;#93;&lt;/span&gt; =&amp;gt; greenPlant.jpg&lt;br/&gt;
)&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;_id&amp;#93;&lt;/span&gt; =&amp;gt; 2&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;img&amp;#93;&lt;/span&gt; =&amp;gt; Array (&lt;br/&gt;
    &lt;span class=&quot;error&quot;&gt;&amp;#91;1276291209&amp;#93;&lt;/span&gt; =&amp;gt; redScarf.jpg&lt;br/&gt;
    &lt;span class=&quot;error&quot;&gt;&amp;#91;1276299876&amp;#93;&lt;/span&gt; =&amp;gt; blueScarf.jpg&lt;br/&gt;
)&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;_id&amp;#93;&lt;/span&gt; =&amp;gt; 3&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;img&amp;#93;&lt;/span&gt; =&amp;gt; Array (&lt;br/&gt;
    &lt;span class=&quot;error&quot;&gt;&amp;#91;1276290193&amp;#93;&lt;/span&gt; =&amp;gt; purpleCar.jpg&lt;br/&gt;
    &lt;span class=&quot;error&quot;&gt;&amp;#91;1276299233&amp;#93;&lt;/span&gt; =&amp;gt; yellowCar.jpg&lt;br/&gt;
    &lt;span class=&quot;error&quot;&gt;&amp;#91;1276290971&amp;#93;&lt;/span&gt; =&amp;gt; whiteCar.jpg&lt;br/&gt;
)&lt;/p&gt;</comment>
                            <comment id="14842" author="chx" created="Thu, 17 Jun 2010 15:26:40 +0000"  >&lt;p&gt;just query on units.id , it works, and don&apos;t forget $elemMatch if you are querying on two.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                            <outwardlinks description="duplicates">
                                        <issuelink>
            <issuekey id="10498">SERVER-267</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9.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 Jun 2010 15:26:40 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        11 years, 21 weeks 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>ian@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            11 years, 21 weeks ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10000" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Old_Backport</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10000"><![CDATA[No]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>benmen</customfieldvalue>
            <customfieldvalue>glenn</customfieldvalue>
            <customfieldvalue>bugslayer</customfieldvalue>
            <customfieldvalue>jshanks</customfieldvalue>
            <customfieldvalue>chx</customfieldvalue>
            <customfieldvalue>phpmoadmin</customfieldvalue>
            <customfieldvalue>scotthernandez</customfieldvalue>
            <customfieldvalue>lunakid</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrpl7j:</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>20596</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|ht06rb:</customfieldvalue>

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