<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:10:22 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-701] Client-side array and document matching</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-701</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description>&lt;p&gt;Followon to &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-641&quot; title=&quot;Client-side array and document matching&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-641&quot;&gt;&lt;del&gt;CDRIVER-641&lt;/del&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Matcher_t does not seem to work for values as arrays. The docs may indicate it should (&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/blob/58f9962777150d013101581a1e974620acf57696/doc/matcher.page#L11)?&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/blob/58f9962777150d013101581a1e974620acf57696/doc/matcher.page#L11)?&lt;/a&gt;  &lt;/p&gt;

&lt;p&gt;I&apos;m running the latest (1.1.6) release&lt;/p&gt;



&lt;p&gt;Generate a doc/subdoc with string value&lt;/p&gt;

&lt;p&gt;&amp;gt;&amp;gt;&amp;gt; doc_str = {&quot;base&quot;:{&quot;subdoc&quot;:&quot;value&quot;}}&lt;/p&gt;


&lt;p&gt;Generate a doc/subdoc with string inside array&lt;/p&gt;

&lt;p&gt;&amp;gt;&amp;gt;&amp;gt; doc_arr = {&quot;base&quot;:{&quot;subdoc&quot;:&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;value&amp;quot;&amp;#93;&lt;/span&gt;}}&lt;/p&gt;


&lt;p&gt;Generate a valid mongo spec that should match on both documents&lt;/p&gt;

&lt;p&gt;&amp;gt;&amp;gt;&amp;gt; spec = {&quot;base.subdoc&quot;:{&quot;$in&quot;:&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;value&amp;quot;, &amp;quot;some_other_value&amp;quot;&amp;#93;&lt;/span&gt;}}&lt;/p&gt;

&lt;p&gt;Generate the matcher&lt;/p&gt;

&lt;p&gt;&amp;gt;&amp;gt;&amp;gt; matcher = bc.generate_matcher(spec)&lt;/p&gt;


&lt;p&gt;Compare correctly against the first document&lt;/p&gt;

&lt;p&gt;&amp;gt;&amp;gt;&amp;gt; bc.match(matcher, doc_str)&lt;/p&gt;

&lt;p&gt;True&lt;/p&gt;


&lt;p&gt;Compares incorrectly against the second document.&lt;/p&gt;

&lt;p&gt;&amp;gt;&amp;gt;&amp;gt; bc.match(matcher, doc_arr)&lt;/p&gt;

&lt;p&gt;False&lt;/p&gt;
</description>
                <environment>RHEL6</environment>
        <key id="209478">CDRIVER-701</key>
            <summary>Client-side array and document matching</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="2">Won&apos;t Fix</resolution>
                                        <assignee username="jesse@mongodb.com">A. Jesse Jiryu Davis</assignee>
                                    <reporter username="bauman">Dan Bauman</reporter>
                        <labels>
                    </labels>
                <created>Tue, 9 Jun 2015 16:47:58 +0000</created>
                <updated>Mon, 24 Apr 2017 23:23:40 +0000</updated>
                            <resolved>Mon, 21 Sep 2015 18:43:32 +0000</resolved>
                                    <version>1.1.6</version>
                                                    <component>libmongoc</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="1068466" author="jesse" created="Thu, 22 Oct 2015 21:31:52 +0000"  >&lt;p&gt;I&apos;ve reconsidered, and I &lt;b&gt;still&lt;/b&gt; don&apos;t think we should continue developing mongoc_matcher_t. &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=bauman&quot; class=&quot;user-hover&quot; rel=&quot;bauman&quot;&gt;bauman&lt;/a&gt; I really appreciate your effort to extend this feature; I think you have two clear options:&lt;/p&gt;

&lt;p&gt;1. Copy mongoc_matcher_t and related code into your own repository and continue developing it there to support additional features.&lt;br/&gt;
2. Port your client-side matcher library from mongoc_matcher_t to wrap the server&apos;s actual query engine instead. &lt;/p&gt;

&lt;p&gt;The latter is more promising since you will have the server&apos;s full query power, and you&apos;ll be able to easily track enhancements to the query engine as they&apos;re released in the future.&lt;/p&gt;

&lt;p&gt;In the server&apos;s C++ matcher API, you call MatchExpressionParser::parse(const BSONObj&amp;amp; obj).getValue() to get a MatchExpression.  MatchExpression::matchesBSON will match the query against a given document.&lt;/p&gt;

&lt;p&gt;A colleague on the server team says, &lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;It should be possible to link the $BUILD_DIR/mongo/db/matcher/expressions library without the rest of the server codebase. This is exacly what the matcher unit tests do, for example.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/master/src/mongo/db/matcher/SConscript#L27&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/blob/master/src/mongo/db/matcher/SConscript#L27&lt;/a&gt; is where we declare the expressions library&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/master/src/mongo/db/matcher/SConscript#L49-L60&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/blob/master/src/mongo/db/matcher/SConscript#L49-L60&lt;/a&gt; is a unit test that depends on it&lt;/p&gt;&lt;/blockquote&gt;</comment>
                            <comment id="941358" author="jesse" created="Tue, 16 Jun 2015 02:32:51 +0000"  >&lt;p&gt;Neat! I like your search package. If you&apos;re willing to make the effort I&apos;d look forward to a patch from you.&lt;/p&gt;</comment>
                            <comment id="941317" author="bauman" created="Tue, 16 Jun 2015 01:24:03 +0000"  >&lt;p&gt;understand that it is never intended to be anywhere close to full mongodb.  I certainly don&apos;t want it to be anywhere close.&lt;/p&gt;

&lt;p&gt;It&apos;s functional as-is, but I had to write my own unwind function to generate discrete documents when it ran into a list.  I don&apos;t mind the slowdown, but I&apos;d like let libbson do the work where it makes sense.  &lt;/p&gt;

&lt;p&gt;I&apos;m still trying to wrap my head around the design pattern to understand what I&apos;m looking at.  I&apos;m not opposed to building a few cases and providing unit tests for the ones I need.  Going to take a while.&lt;/p&gt;

&lt;p&gt;simple ctypes wrapper for what I need.  Nothing special.&lt;br/&gt;
&lt;a href=&quot;https://github.com/bauman/bsonsearch&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/bauman/bsonsearch&lt;/a&gt;&lt;/p&gt;
</comment>
                            <comment id="941305" author="jesse" created="Tue, 16 Jun 2015 01:03:08 +0000"  >&lt;p&gt;I&apos;m cautious about adding features to the matcher, since that is an unending task and a doomed one. The driver will never behave the same as any particular MongoDB version. I know I just added some features myself, but I only did it because the driver needed those features for self-testing.&lt;/p&gt;

&lt;p&gt;That said, if you&apos;d like to offer a very well-tested pull request I&apos;d consider it for 1.2 or 1.3.&lt;/p&gt;

&lt;p&gt;Also, what shell are you using to test it? Is that a Python wrapper around the matcher?&lt;/p&gt;</comment>
                            <comment id="935551" author="bauman" created="Tue, 9 Jun 2015 19:35:47 +0000"  >&lt;p&gt;Doesn&apos;t look like it is the $in operator&lt;/p&gt;


&lt;p&gt;&amp;gt;&amp;gt;&amp;gt; spec = &lt;/p&gt;
{&quot;base.subdoc&quot;:&quot;value&quot;}

&lt;p&gt;&amp;gt;&amp;gt;&amp;gt; matcher = bc.generate_matcher(spec)&lt;/p&gt;

&lt;p&gt;&amp;gt;&amp;gt;&amp;gt; bc.match(matcher, doc_str)&lt;/p&gt;

&lt;p&gt;True&lt;/p&gt;

&lt;p&gt;&amp;gt;&amp;gt;&amp;gt; bc.match(matcher, doc_arr)&lt;/p&gt;

&lt;p&gt;False&lt;/p&gt;


&lt;p&gt;I guess it needs to unroll the right side in &lt;br/&gt;
_mongoc_matcher_iter_eq_match&lt;/p&gt;


&lt;p&gt;&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/blob/480de4b10511c9ad7b406a02979285b9e8cc8be7/src/mongoc/mongoc-matcher-op.c#L416&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/blob/480de4b10511c9ad7b406a02979285b9e8cc8be7/src/mongoc/mongoc-matcher-op.c#L416&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Something like...&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;thead&gt;
			&lt;tr id=&quot;syntaxplugin_title&quot;&gt;
			&lt;td bgcolor=&quot;#f5f5f5&quot; style=&quot;font-family: Arial,sans-serif; color: #333; border-bottom: 1px solid #bbb; background-color: #f5f5f5 !important; font-weight: bold; line-height: 1em;&quot; &gt;
				&lt;p style=&quot;margin: 5px 10px; padding: 0;&quot;&gt;mongoc-matcher-op.c&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/thead&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;case _TYPE_CODE(BSON_TYPE_UTF8, BSON_TYPE_ARRAY):&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;      {&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;         bson_iter_t left_array;&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;         bson_iter_t right_array;&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;         bson_iter_recurse (iter, &amp;amp;right_array);&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;         //still thinking&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;         while (true) {&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;            bool right_has_next = bson_iter_next (&amp;amp;right_array);&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;            //still thinking&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;         }&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;      }&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="235798">CDRIVER-954</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </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|hsa5mf:</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>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>