- Published on
Connecting to MongoDB Compass to access local MongoDB databases via the new mongosh shell
- Authors
- Name
- interglobalmedia
- @letsbsocial1
It is very simple to connect to one’s local MongoDB databases
using MongoDB Compass
. All you need to do is connect to your (new) mongosh shell
via Terminal
. I installed my instance of the mongoldb-community
’s latest version (6.0.1
) using Homebrew
. So to start the mongoldb-community service
with Homebrew
, I first run the following command:
brew services start mongodb-community
Next, I run the following command:
mongosh
Then I run the following command to see what databases
I have locally:
show dbs
Then I use the following command to switch to the database
I want to use:
use bookit
In my case, I switch to a database
called bookit
.
Then, I go into MongoDB Compass
intalled on my computer
, and I start a new connection. When I open up `Compass``, it looks like the following:
And, as you can see within the screenshot
, I have entered my localhost url
, so all I have to do is click on the Connect button
. And when I do so, the following appears:
Then, I just click on the `database`` of my choice in the sidebar to the left. And that is it!
Happy MongoDB Compassing!