Can't create db after installing mongodb 6.0.5 on macOS catalina 10.15.7

Since home-brew is not supported on this version of macOS, I installed mongodb by downloading mongodb-macos-x86_64-6.0.5.tar; extracting; copying /bin/mongod (and mongos) to /usr/local/bin. I created /usr/local/etc/mongod.conf.

I also downloaded mongosh-1.8.1-darwin-x64 and copied the bin folder to /usr/local/bin. I have started mongodb daemon (mongod) (either directly or via launchctl)

When I started mongosh, the output includes:
Using MongoDB: 6.0.5
Using Mongosh: 1.8.1

The prompt is “test>”. From mongosh, I enter the command: “use mydb” (and the prompt changes accordingly). But when I then execute “show dbs” only the system ones (admin, config, local).

I have the similar problem using python/pymongo and compass.

I’ve installed mongo on another macOS ventura without any problems and everything works very well. I’m just stumped why I’m having this problem on catalina. Any help would be appreciated. tia.

Hi @rollin_rollin welcome to the community!

If you’re just changing the database without writing anything to it, it’s not created and will not show up in the output of show dbs. For example, I started a fresh install of MongoDB 6.0.5 locally:

test> show dbs
admin    8.00 KiB
config  12.00 KiB
local    8.00 KiB

test> use mydb
switched to db mydb

mydb> show dbs  //note that there's no "mydb" here
admin    8.00 KiB
config  12.00 KiB
local    8.00 KiB

mydb> db.mycoll.insertOne({})
  acknowledged: true,
  insertedId: ObjectId("6449c8158ef002c5093eae9f")

mydb> show dbs  //note that it appears after I did a write
admin    8.00 KiB
config  12.00 KiB
local    8.00 KiB
mydb     8.00 KiB

Note that mydb only shows up after I write to a collection under it.

This is expected behaviour, but if you’re seeing something different (e.g. an error os something), then please provide more details such as:

  • The content of /usr/local/etc/mongod.conf
  • The output of db.adminCommand({getCmdLineOpts: 1})
  • Any error you’re seeing, and what you tried that resulted in that error

Best regards

Thanks very much for info and test. Very stupid on my part; but thanks of providing the test and explanation.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.