<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:40: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>[CSHARP-1722] Command aggregate failed: not authorized on DB to execute command</title>
                <link>https://jira.mongodb.org/browse/CSHARP-1722</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;Doing &lt;/p&gt;

&lt;p&gt;_db.GetCollection&amp;lt;TEntity&amp;gt;(typeof(TEntity).Name).AsQueryable().Count()&lt;/p&gt;

&lt;p&gt;results in &lt;/p&gt;

&lt;p&gt;Command aggregate failed: not authorized on DB to execute command { aggregate: &quot;Customer&quot;, pipeline: [ { $sort: &lt;/p&gt;
{ lastname: 1, companyShortTitle: 1 }
&lt;p&gt; }, { $group: { _id: 1, __result: &lt;/p&gt;
{ $sum: 1 }
&lt;p&gt; } } ], cursor: {} }.&lt;/p&gt;

&lt;p&gt;The user that uses the conncection has dbAdmin, dbOwner and readWrite roles.&lt;/p&gt;</description>
                <environment>Windows</environment>
        <key id="303252">CSHARP-1722</key>
            <summary>Command aggregate failed: not authorized on DB to execute command</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="brgrz">Marko Hrovatic</reporter>
                        <labels>
                            <label>driver</label>
                            <label>question</label>
                    </labels>
                <created>Fri, 22 Jul 2016 13:35:06 +0000</created>
                <updated>Fri, 5 Apr 2019 13:58:58 +0000</updated>
                            <resolved>Fri, 22 Jul 2016 14:23:39 +0000</resolved>
                                    <version>2.2.4</version>
                                                    <component>Security</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="1332400" author="brgrz" created="Fri, 22 Jul 2016 13:59:25 +0000"  >&lt;p&gt;You are right. I just debugged my code. The issue was with IoC/DI. In some cases the Credentials on MongoClient are empty, don&apos;t know why but I will figure it out. This was hard to figure out because it manifested only within one controller action.&lt;/p&gt;

&lt;p&gt;You can close this for now.&lt;/p&gt;</comment>
                            <comment id="1332389" author="craiggwilson" created="Fri, 22 Jul 2016 13:52:25 +0000"  >&lt;p&gt;Connections are authenticated when they are opened, so if it works in one place and not the other, it&apos;s gonna have to be a permissions thing.&lt;/p&gt;

&lt;p&gt;Are you sure that typeof(TEntity).Name is the correct collection name?  Is TEntity polymorphic and not actually what you are expecting?&lt;/p&gt;</comment>
                            <comment id="1332382" author="brgrz" created="Fri, 22 Jul 2016 13:48:28 +0000"  >&lt;p&gt;1. Not at this collection but can at others in the same DB with the same user.&lt;/p&gt;

&lt;p&gt;2. Haven&apos;t tried.&lt;/p&gt;</comment>
                            <comment id="1332375" author="craiggwilson" created="Fri, 22 Jul 2016 13:40:40 +0000"  >&lt;p&gt;1. Can you issue other queries? Using find or count? Can you insert/update/remove?&lt;/p&gt;

&lt;p&gt;2. Are you able to authenticate with the shell and execute these commands?&lt;/p&gt;</comment>
                            <comment id="1332371" author="brgrz" created="Fri, 22 Jul 2016 13:39:07 +0000"  >&lt;p&gt;This only happens when Authorization is enabled in MongoDb (with mongod -auth). Otherwise the Count runs fine.&lt;/p&gt;</comment>
                    </comments>
                    <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|hsnve7:</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>