Reputation: 1070
This is the newbiest question ever but I don't understand these instructions from MongoDB:
Replace DATABASE with the name of the database you wish to import/export to your cluster, and COLLECTION with the name of the collection you wish to import/export to your cluster.
I understand what "collections" are because I see them in the admin panel under "collections."
But I don't see "databases" listed anywhere, nor do I see clusters.
If my account dashboard shows this:
MyProject > Cluster0 > MyCollection
What do I write here?
mongo "mongodb+srv://CLUSTER.kaarp.mongodb.net/DATABASE"
Upvotes: 9
Views: 6085
Reputation: 521
Yes, it is very confusing and wastes a lot of time for lots of people to figure out things this way. When there is a hierarchy of things like project>cluster>database>collection, this should be very obvious in the UI and in the documentation as well.
To summarize, when you go to MongoDB Atlas you will see a link to projects in your account. Select this option to display the list of projects. Select a project and that will take you to the project page which displays the list of clusters in the project. A cluster is a group of machines which works together to store your databases and at the same time provides fault tolerance, high availability and scalability.
Every database resides in a cluster and every collection resides in a database. Hence the hierarchy project>cluster>database>collection. As a developer, you instinct will be to create a database in a cluster and then use it to store your collections in the database. But there is no button to create a database!
It seems you can not create a database directly but only as part of creating a collection. So you have to create a collection by navigating the "Browse Collection" link. At the time of creating the collection, you will be able to set the name of the new database to host your collection.
However, once you have created at least one database as above, you will be able to see the "Create Database" button! Pretty weird workflow to me.
Upvotes: 4
Reputation: 1710
Upvotes: 8
Reputation: 876
It is confusing for me too. I am using MongoDB Atlas and I discovered that, when you create a collection for the first time, you are asked to create a database name. As far as I understand, the hierarchy goes cluster > database > collection.
Upvotes: 1