<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:35:42 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>[GODRIVER-1113] ListCollectionNames cannot be used</title>
                <link>https://jira.mongodb.org/browse/GODRIVER-1113</link>
                <project id="14289" key="GODRIVER">Go Driver</project>
                    <description>&lt;p&gt;I&apos;m not sure if this is something I am doing wrong, but I seem to be unable to use ListCollectionNames (which is should work according to&#160;&#160;&lt;a href=&quot;https://godoc.org/go.mongodb.org/mongo-driver/mongo#Database.ListCollectionNames&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://godoc.org/go.mongodb.org/mongo-driver/mongo#Database.ListCollectionNames&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;Specifically, my code looks like this:&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;{{ client, err := mongo.Connect(context.Background(), options.Client().ApplyURI(&quot;mongodb://127.0.0.1:27017&quot;)) client, err := mongo.Connect(context.Background(), options.Client().ApplyURI(&quot;mongodb://127.0.0.1:27017&quot;)) db := client.Database(&quot;thedb&quot;) names, _ := db.ListCollectionNames(context.Background(), bson.D{})}}&lt;/p&gt;</description>
                <environment>macOS: 10.14.5&lt;br/&gt;
go: go1.12.5 darwin/amd64&lt;br/&gt;
Using go modules (not dep)</environment>
        <key id="790631">GODRIVER-1113</key>
            <summary>ListCollectionNames cannot be used</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</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="13202">Works as Designed</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="ajlee1000">Andrew Lee</reporter>
                        <labels>
                    </labels>
                <created>Wed, 5 Jun 2019 23:04:03 +0000</created>
                <updated>Fri, 27 Oct 2023 13:16:33 +0000</updated>
                            <resolved>Thu, 6 Jun 2019 14:33:56 +0000</resolved>
                                    <version>1.0.2</version>
                                                    <component>Core API</component>
                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="2274765" author="ajlee1000" created="Thu, 6 Jun 2019 19:25:18 +0000"  >&lt;p&gt;Thank you&lt;/p&gt;</comment>
                            <comment id="2274570" author="divjot.arora" created="Thu, 6 Jun 2019 19:05:45 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=ajlee1000&quot; class=&quot;user-hover&quot; rel=&quot;ajlee1000&quot;&gt;ajlee1000&lt;/a&gt; &lt;tt&gt;ListCollectionNames&lt;/tt&gt; is really a wrapper for &lt;tt&gt;Database.ListCollections(options.ListCollections.SetNameOnly(true)&lt;/tt&gt;. It retrieves the cursor from &lt;tt&gt;ListCollections&lt;/tt&gt;, iterates it, and looks for the &lt;tt&gt;name&lt;/tt&gt; field in each document. I&apos;d recommend doing this instead of using &lt;tt&gt;RunCommand&lt;/tt&gt; or &lt;tt&gt;RunCommandCursor&lt;/tt&gt;. The relevant code can be found at&#160;&lt;a href=&quot;https://github.com/mongodb/mongo-go-driver/blob/master/mongo/database.go#L268&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-go-driver/blob/master/mongo/database.go#L268&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="2274173" author="ajlee1000" created="Thu, 6 Jun 2019 16:59:24 +0000"  >&lt;p&gt;I&apos;m sorry i&apos;m relatively new to Mongo in general. How would you do a `show collections` db.RunCommand interface using bson?&lt;/p&gt;</comment>
                            <comment id="2274117" author="ajlee1000" created="Thu, 6 Jun 2019 16:36:35 +0000"  >&lt;p&gt;Got it. Thanks&lt;/p&gt;</comment>
                            <comment id="2274115" author="divjot.arora" created="Thu, 6 Jun 2019 16:35:10 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=ajlee1000&quot; class=&quot;user-hover&quot; rel=&quot;ajlee1000&quot;&gt;ajlee1000&lt;/a&gt; Thanks for the suggesttion regarding GoDoc. For custom commands, you can use &lt;tt&gt;Database.RunCommand&lt;/tt&gt; and &lt;tt&gt;Database.RunCommandCursor&lt;/tt&gt; to run any command and get back a result/error.&lt;/p&gt;</comment>
                            <comment id="2274110" author="ajlee1000" created="Thu, 6 Jun 2019 16:30:11 +0000"  >&lt;p&gt;Also, the option to send completely custom commands to MongoDB and return []byte to manually parse would be immensely useful until mongo-go-driver supports all operations&lt;/p&gt;</comment>
                            <comment id="2274087" author="ajlee1000" created="Thu, 6 Jun 2019 16:18:15 +0000"  >&lt;p&gt;Whats the general timeframe of the next minor update?&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;Also, might I suggest you guys host your own Godoc server (instead of relying on godoc.org) so that you can have the latest released version docs up rather than what is currently in the master branch (at least until you guys have more reliable documentation for the Go driver)?&lt;/p&gt;</comment>
                            <comment id="2274016" author="ajlee1000" created="Thu, 6 Jun 2019 15:50:33 +0000"  >&lt;p&gt;O i see. Thanks.&#160;&lt;/p&gt;</comment>
                            <comment id="2273835" author="divjot.arora" created="Thu, 6 Jun 2019 14:33:56 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=ajlee1000&quot; class=&quot;user-hover&quot; rel=&quot;ajlee1000&quot;&gt;ajlee1000&lt;/a&gt; &lt;tt&gt;ListCollectionNames&lt;/tt&gt; is a new feature, so it was added to the master branch and not backported to the 1.0.x release branch. It will be included in the next minor release (1.1.0).&lt;/p&gt;</comment>
                            <comment id="2273341" author="ajlee1000" created="Wed, 5 Jun 2019 23:29:49 +0000"  >&lt;p&gt;I have attached a screenshot of the `go build` output as well as attached the test project which caused this (testmongo.zip).&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;I&apos;m not necessarily going to be on this scrum board, so you can reach me at andrew@voiceit.io.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="219206" name="Screen Shot 2019-06-05 at 5.57.15 PM.png" size="16895" author="ajlee1000" created="Wed, 5 Jun 2019 23:01:14 +0000"/>
                            <attachment id="219207" name="testmongo.zip" size="2509" author="ajlee1000" created="Wed, 5 Jun 2019 23:28: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|husgsn:</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>