Create database in MongoHQ from C#

53 views Asked by At

I'm trying to create a Database in MongoHQ from C# code. I read that by just calling

server.GetDatabase("DBName");

it creates the DB if it doesn't exist, nevertheless nothing is created.

Is it possible to do what I want to do? I have a free account =/

Thanks in advance

2

There are 2 answers

3
seand On

You need to create a collection for the database to get created.

0
Jason McCay On

this is Jason from MongoHQ.

If you have a free account, you probably already have a database and would not have access to create new databases without either:

a) creating the new database through the MongoHQ web application.

b) using our MongoHQ API to automatically create new databases.

Also, since you don't have admin-level access on the free plans, you will need to specify the database you are accessing and you can then list the collections for that database.

Hope this helps!