mongodbrobo3t

MongoDB and Robo3T: Whats the point of connections if databases are shared across them?


Im trying to create a new connection for a new mongodb database using Robo3T and i just found out that whenever i create a new connection, the existing databases in older connections are added to this new connection. And in this case, if i were to delete testDB, it would delete that db for all the connections.

Why is that? Am i doing something wrong?

enter image description here


Solution

  • Let's first define the terminology:

    MongoDB instance - database server, can include multiple databases.
    database - single database within the server. testDb and config are databases.
    connection - basically connection to MongoDB instance. You can create multiple connections to the same instance (and this is exactly what you did).

    So now if you drop the database using one of connections it'll be reflected in other connection too, because it's the same database server and the same database.

    I guess what you wanted to do is create separate databases - cursorDB and websocketDB on the same MongoDB instance. You don't need to create different connections for them in Robo3T, one connection is enough.
    You can create a database right clicking on the connection icon (computer screen icon) in Robo3T and then selecting Create database.