<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:54:48 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>[JAVA-1515] Check if a database exists on MongoDB without using mongoClient.getDatabaseNames()</title>
                <link>https://jira.mongodb.org/browse/JAVA-1515</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;We configured our mongobd to forbid the &quot;listdatabases&quot; (i.e, mongClient.getDatabaseNames()) feature for privacy reasons&lt;/p&gt;

&lt;p&gt;I would like to check whether a database exists in MongoDB without using mongClient.getDatabaseNames().&lt;/p&gt;

&lt;p&gt;If I use, mongoClient.getDB(&quot;mydb&quot;), mongodb creates a new db instance which can&apos;t help to check whether dbname exist.&lt;/p&gt;

&lt;p&gt;Can we have an api to check existance of database (like : mongoClient.isDBExists(&quot;db_name&quot;) )?&lt;/p&gt;
</description>
                <environment></environment>
        <key id="164734">JAVA-1515</key>
            <summary>Check if a database exists on MongoDB without using mongoClient.getDatabaseNames()</summary>
                <type id="2" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14711&amp;avatarType=issuetype">New Feature</type>
                                            <priority id="1" iconUrl="https://jira.mongodb.org/images/icons/priorities/blocker.svg">Blocker - P1</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="ross@mongodb.com">Ross Lawley</assignee>
                                    <reporter username="shivb">shiv</reporter>
                        <labels>
                    </labels>
                <created>Tue, 21 Oct 2014 12:20:05 +0000</created>
                <updated>Wed, 22 Oct 2014 09:03:35 +0000</updated>
                            <resolved>Tue, 21 Oct 2014 14:09:56 +0000</resolved>
                                    <version>2.11.1</version>
                                                    <component>API</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="746985" author="shivb" created="Wed, 22 Oct 2014 09:03:35 +0000"  >&lt;p&gt;Thanks for clarifying &lt;/p&gt;</comment>
                            <comment id="746120" author="ross@10gen.com" created="Tue, 21 Oct 2014 14:09:56 +0000"  >&lt;p&gt;Closing as this is not a Java driver issue but rather a mongodb configuration issue.&lt;/p&gt;</comment>
                            <comment id="746119" author="ross@10gen.com" created="Tue, 21 Oct 2014 14:08:21 +0000"  >&lt;p&gt;The way to check if a database exists is to use the &lt;tt&gt;listdatabases&lt;/tt&gt; command and see if the database is listed, there is no other command you can use.  You could setup a user with a different &lt;a href=&quot;http://docs.mongodb.org/manual/reference/built-in-roles/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;mongodb role (with readAnyDatabase)&lt;/a&gt; and use that user to to call the command. You should still be able to assign roles to general users so that they can&apos;t use listdatabases and then meet your privacy requirements.&lt;/p&gt;

&lt;p&gt;For future reference, the best place for general questions regarding MongoDB usage or the Java driver specifics is the &lt;a href=&quot;https://groups.google.com/forum/#!forum/mongodb-user&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;mongodb-user mailinglist&lt;/a&gt; or &lt;a href=&quot;http://stackoverflow.com&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;stackoverflow&lt;/a&gt; as you will reach a boarder audience there.&lt;/p&gt;

&lt;p&gt;Ross&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|hs38v3:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>143774</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>