First of all, a bit of background: I’m currently working through a Udemy course. The instructor demos installing MongoDB 4.0, then running mongod in hyper (as the instructor is using a Mac), then opening a new shell and running mongo.
I’m trying to achieve the same outcome with MongoDB 6.0.3. I know that now MongoDB uses a separate shell, mongosh. I downloaded the shell and put it in the bin with the other MongoDB downloads. I also set the path environmental variables. When I run the mongod command in the Bash terminal, it seems to be working, but when I open a new Bash shell and run mongosh, it’s giving me errors. I tried the commands for mongo or mongos, and still not working.
I wanted to share screencaps here, as I think that’d be more helpful, but it looks like I’m going to need to clean off some diskspace to run Photoshop, so for now I hope these descriptions will help. Here is what I’m seeing in the Bash shell when I run each command:
“$ mongosh
bash: mongosh: command not found”
“$ mongo
BadValue: error: no args for --configdb
try ‘C:\Program Files\MongoDB\Server\6.0\bin\mongos.exe --help’ for more information”
I double-checked, and my mongosh file is definitely in “C:\Program Files\MongoDB\Server\6.0\bin”, which is the path I set in the environmental variables section.
I followed what this guy did in the video: Mongo command is not working/found in MongoDB 6.0+ || MongoDB error fix - YouTube – with the one difference being that I put my mongosh file with the other MongoDB files in the bin folder… though I don’t see that this would make a difference. But when I run the “mongosh” command in Bash, I get the error above. I’m confused, as it seems to work fine for him in the tutorial video, so I came here, as I’m quite frustrated with trying to troubleshoot at this point. I’ve been troubleshooting MongoDB installations issues for a while now, between this and other differences in the updated version, and browsing here and Stack Overflow, but still confused as to why it’s not working.
Any help would be appreciated! Thanks!
Edit: Oh my gosh. I just decided to try the command CLI rather than the Bash shell, and… it works on the command prompt, but not the Bash shell. I suppose I can use the command prompt, but now I’m confused why it’s not working in the Bash shell. I feel a little silly realizing this after typing all that, but I do prefer to work in the Bash shell if possible.