MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017 | Intel macOS monterey - mongodb

I use macOS monterey (intel). I tried installing mongodb manually. Same problem. I used homebrew to install mongodb-community#6.0. Same problem.
Nomatter what I try. I get this error. Please help!!!

For me, it worked just by stopping and starting the MongoDB community service
First Stop the service
brew services stop mongodb-community
then Start it again
brew services start mongodb-community

I have had exactly the same problem, though on an M1 Mac. After a lot of googling mongo.log messages and changing ownership and group of various files, I managed to get mongo up and running again by reverting to version 5.
The sequence which should get you up and running is:
brew services stop mongodb-community
brew install mongodb/brew/mongodb-community#5.0
brew services start mongodb/brew/mongodb-community#5.0
A quick check using mongosh indicated all was up and running with no loss of data. I made a copy of my data before I made any changes, just in case:
cd /opt/homebrew/var
cp -a mongodb mongodbsave

Related

MongoDB Installation error. what is solution for this error?

what is solution for this error.
I want to install MongoDB in Mac with home-brew but this error in terminal
❯ brew tap mongodb/brew
❯ brew install mongodb-community
Error: No such file or directory - /opt/homebrew/var/homebrew/linked/mongodb-community
I want to install MongoDB...
Download the MongoDB Community Server version suitable for your Mac from the official website: https://www.mongodb.com/download-center/community.
Install MongoDB by double-clicking the downloaded .pkg file.
Note: To run MongoDB as a service on macOS, refer to the official MongoDB documentation on setting up launchd: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/#configure-launchd-to-start-mongodb-automatically.

MongoDB error when tryin to start up services

I recently have been having issues with mongoDB services.
I am running on MacOs Ventura v13.0.1.
I even removed MongoDB from machine and try to re-isntall it.
Install process.
brew tap mongodb/brew
brew install mongodb-community#6.0
Running services
brew services start mongodb-communit#6.0
Checking services
brew services
error
mongodb-community error 3584 root ~/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist
Any help would be great. I have been stuck on this and cannot run a a MongoDB server on my machine.
It sounds like there is an issue with the launch agent plist file for MongoDB. This file is used by macOS to start MongoDB as a service when your machine boots up.
You can tryp following steps to resolve the issue:
Stop MongoDB service by running the command brew services stop mongodb-community#6.0.
Remove the launch agent plist file by running the command rm ~/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist.
Restart MongoDB service by running the command brew services restart mongodb-community#6.0.
Verify that MongoDB service is running by running the command brew services again.
If the issue still persists after following the steps above, you can try uninstalling and reinstalling MongoDB using Homebrew's cleanup command brew cleanup mongodb-community#6.0 before reinstalling.
Also you can check MongoDB's log files located in /usr/local/var/log/mongodb/ to see if there is any error message that can help you troubleshoot the issue.

Trouble running MongoDB server on macOS Monterey 12.0.1

I've installed MongoDB through Homebrew and when I start the server using brew services start mongodb-community (or mongodb-community#5.0) command it immediately fails and turn the brew services list to error!
I already tried giving permission - using Rosetta to install and run - etc. but ended up with the same error.
The only thing I don't know how do (which might potentially work) is to change the directory of MongoDB, but I am not sure that could be a solution or not!
Unloading and loading launchctl solved the permission issue.
Try running below command after installation of mongodb:
sudo brew services restart mongodb/brew/mongodb-community
Then running sudo brew services list will show the mongodb-commuity service status to started.

Can't start Mongodb shell on MacOS Mojave 10.14.2

Installed MongoDB Community Edition version 3.6 (because my work project requires that version). I am for some reason unable to run the MongoDB shell, so when trying to run mongo or mongod from the terminal I just get -bash: mongod: command not found. When checking which Brew services are running with brew services list, mongodb-community#3.6 is listed. The application I'm working on also utilises MongoDB succesfully. My main issue is that I can't access the MongoDB shell.
The solution to my problem was that I was supposed to install the shell separately with brew. This was not the case with previous MongoDB versions and it is not mentioned in the official MongoDB documentation.

Upgrading older mongo database after unintentional mongo version upgrade

Is there any way to upgrade a mongo database after the mongodb package was unintentionally upgraded (3.4.9 -> 3.6.1)?
According to the mongo docs, as a prerequisite of the upgrade, featureCompatibilityVersion has to be set from the mongo cli tool, which, however, needs a running mongod database daemon, which, however, won't run if mongodb package was already upgraded and the database was not set the featureCompatibilityVersion flag.
I'm on ArchLinux, I had mongodb in IgnorePkg but it's dependencies boost-libs and wiredtiger got upgraded anyways. Having pacman cache already wiped out, I compiled older versions of the packages myself, but running mongodb keeps failing with this error:
unsupported WiredTiger file version: this build only supports major/minor versions up to 1/0, and the file is version 2/0: WT_ERROR: non-specific WiredTiger error
I don't have a clue what the hell this means (the problematic version of wiredtiger is 2.9.3-1, version after the upgrade is 2.9.3.20171205-2).
Seems like I can neither downgrade nor upgrade...
Other cli tools (e.g. mongodump) also won't run without a running database, is there any other possibility (some wiredtiger related tool)? Deleting the database and starting afresh is not an option.
I solved the problem by installing the older version of mongodb on a system for which it wasn't a problem to get it pre-packaged (well, Windows 10, even though oficially it's stated the package is for Windows Server 2008), copying the database files (contents of /var/lib/mongodb) there, running it with --dbpath param (mongod --dbpath /path/to/dbfiles), setting the compatibility flag according to the docs and finally copying the db files back to the server.
Would like to know about a better option, but it's good to know the db files are easily transferable to another system, even another architecture (the db was relatively simple and small though).
Running mongod --repair worked for me.
here similar issue, unintentionally upgrade from 4.2.1 to 4.4.3, then mongodb can NOT started..
Final worked solution:
uninstall (latest, but not worked version: 4.4.3)
brew uninstall mongodb-community
reinstall, old but worked 4.2.1
brew install mongodb-community#4.2
run
for now: brew services run mongodb-community#4.2
for now and set bootable: brew services start mongodb-community#4.2
check status
brew services