<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:39:21 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-1355] Can&apos;t Create Database</title>
                <link>https://jira.mongodb.org/browse/CSHARP-1355</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;I want to create a database via C#&lt;br/&gt;
the code can&apos;t work as below:&lt;br/&gt;
var db = mongoSvr.GetDatabase(dbName);&lt;/p&gt;

&lt;p&gt;but if I create a collection just after GetDatabase,new database and collection is append to the server.&lt;/p&gt;
</description>
                <environment>MongoDB 3.1.5 </environment>
        <key id="217750">CSHARP-1355</key>
            <summary>Can&apos;t Create Database</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="9">Done</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="MagicHu">Hu</reporter>
                        <labels>
                    </labels>
                <created>Tue, 21 Jul 2015 07:34:36 +0000</created>
                <updated>Wed, 22 Jul 2015 12:58:45 +0000</updated>
                            <resolved>Tue, 21 Jul 2015 13:43:33 +0000</resolved>
                                    <version>2.0.1</version>
                                                    <component>Operations</component>
                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="972071" author="craiggwilson" created="Wed, 22 Jul 2015 12:58:45 +0000"  >&lt;p&gt;Hi Hu,&lt;/p&gt;

&lt;p&gt;I understand your use case. However, there are not any drivers that can actually create a database without creating a collection and/or inserting a data into that collection. In both 1.x and 2.x, the GetDatabase methods only create a new instance of a local database object and return it: &lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/blob/v1.x/MongoDB.Driver/MongoServer.cs#L667&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/blob/v1.x/MongoDB.Driver/MongoServer.cs#L667&lt;/a&gt; and &lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/blob/master/src/MongoDB.Driver/MongoClient.cs#L115&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/blob/master/src/MongoDB.Driver/MongoClient.cs#L115&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;So, while it may feel dirty (and I agree), if your need is to actually create the database, you&apos;ll need to create a collection and then drop it.&lt;/p&gt;

&lt;p&gt;Craig&lt;/p&gt;</comment>
                            <comment id="971691" author="magichu" created="Wed, 22 Jul 2015 00:50:15 +0000"  >&lt;p&gt;Hi Wilson&lt;/p&gt;

&lt;p&gt;Thank you for your reply.&lt;br/&gt;
But in my case, the application is a Administrator tool,&lt;br/&gt;
Sometimes, administrator only want to create a database without any collection.After create database , someone else will create collection.&lt;br/&gt;
A solution is after GetDatabase , a dummy collection is created,then the dummy collection is dropped.But I think it&apos;s smell bad.&lt;br/&gt;
By the way, driver 1.x ,GetDatabase method really create new database if the database is not exist.&lt;/p&gt;</comment>
                            <comment id="970918" author="craiggwilson" created="Tue, 21 Jul 2015 13:43:33 +0000"  >&lt;p&gt;Hi Hu,&lt;/p&gt;

&lt;p&gt;Databases are created on first use. Simply calling GetDatabase doesn&apos;t create the database. If you want to explicitly create the database, you&apos;ll need to create a collection, or insert some data.&lt;/p&gt;

&lt;p&gt;Craig&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|hsbbj3:</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>