<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:39:17 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>[CSHARP-1327] Mongo Database queries in c#.net</title>
                <link>https://jira.mongodb.org/browse/CSHARP-1327</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;I am using Mongo CSharpDriver-2.0.0 version and IMongoCollection Async in my application. My data collection looks as shown in the figure attached(2.png). &lt;br/&gt;
Here I want to perform a Search operation on Categories, basically we will give comma separated list of Category Names and it should return a list of Records that are matching the categories that are provided as input. &lt;br/&gt;
To implement above functionality I am using the below code: This code works fine when I pass a single category. &lt;/p&gt;

&lt;p&gt;var collection = _database.GetCollection&amp;lt;BusinessDeal&amp;gt;(&quot;BusinessDeals&quot;);&lt;br/&gt;
var filter = Builders&amp;lt;BusinessDeal&amp;gt;.Filter.Eq(&quot;Categories.CategoryName&quot;, categorylist) | Builders&amp;lt;BusinessDeal&amp;gt;.Filter.Eq(&quot;Accessgroups.AccessgroupName&quot;, groups);&lt;br/&gt;
var result = await collection.Find(filter).ToListAsync();&lt;/p&gt;


&lt;p&gt;But my requirement is to get the records when I provide a Comma separated categories List. For that implementation I have implemented the following code:&lt;br/&gt;
                var collection = _database.GetCollection&amp;lt;BusinessDeal&amp;gt;(&quot;BusinessDeals&quot;);&lt;br/&gt;
                var filter = Builders&amp;lt;BusinessDeal&amp;gt;.Filter.AnyIn(&quot;Categories.CategoryName&quot;, categorylist.Split(&apos;,&apos;).ToArr()) | &lt;br/&gt;
                              Builders&amp;lt;BusinessDeal&amp;gt;.Filter.AnyIn(&quot;Accessgroups.AccessgroupName&quot;, groups.Split(&apos;,&apos;).ToArr());&lt;br/&gt;
                var result = await collection.Find(filter).ToListAsync();&lt;br/&gt;
The above code is not returning any results and throwing error as &#8220;Not Yielded any Results&#8221; and Status message as &#8220;Failed&#8221;.&lt;/p&gt;</description>
                <environment>Windows</environment>
        <key id="211752">CSHARP-1327</key>
            <summary>Mongo Database queries in c#.net</summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</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="arvindachary.n@sparshcom.net">Arvind Chary</reporter>
                        <labels>
                            <label>question</label>
                    </labels>
                <created>Fri, 19 Jun 2015 08:08:05 +0000</created>
                <updated>Fri, 5 Apr 2019 13:59:01 +0000</updated>
                            <resolved>Mon, 22 Jun 2015 19:39:45 +0000</resolved>
                                    <version>2.0.1</version>
                                                    <component>API</component>
                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="946744" author="arvindachary.n@sparshcom.net" created="Mon, 22 Jun 2015 10:53:27 +0000"  >&lt;p&gt;Hello Craig,&lt;br/&gt;
	I was able to successfully implement the fix that you have provided to me. Today I have tried to post an issue on google group according to your suggestion, I was able create the post successfully without any issues. But when I completed my composing the post and clicked on the &quot;Post&quot; button, I have not got any message saying that My post was created or not. So I have created a new post on JIRA (&lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-1330&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/CSHARP-1330&lt;/a&gt;). Please go through this and help me.&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
Arvind.&lt;/p&gt;
</comment>
                            <comment id="945288" author="craiggwilson" created="Fri, 19 Jun 2015 11:21:03 +0000"  >&lt;p&gt;Hi Arvind,&lt;/p&gt;

&lt;p&gt;For future reference, questions such as this are better asked on stackoverflow or our discussion list: &lt;a href=&quot;https://groups.google.com/forum/?pli=1#!forum/mongodb-user&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://groups.google.com/forum/?pli=1#!forum/mongodb-user&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;First off, you&apos;ll want to use just &lt;tt&gt;In&lt;/tt&gt; instead of &lt;tt&gt;AnyIn&lt;/tt&gt;. Other than that, have you taken into account that your comma separated list might have whitespace? &quot;One, Two&quot; instead of &quot;One,Two&quot;?&lt;/p&gt;

&lt;p&gt;Second, you can see exactly what query is getting generated by using ToString() on the result of the Find:&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;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;var query = collection.Find(filter);&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;var queryString = query.ToString();&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;var result = await query.ToListAsync();&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;It would be helpful to know what query is actually getting generated and, if it looks correct, does it run in the shell?&lt;/p&gt;

&lt;p&gt;Craig&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="78647" name="2.png" size="66637" author="arvindachary.n@sparshcom.net" created="Fri, 19 Jun 2015 08:08:05 +0000"/>
                    </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|hsah3j:</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>