I've just upgraded to MacOS 12.6 and my Elixir/Phoenix app is no longer able to connect to MongoDB. When I start Phoenix I get the following error:
13:00:40.900 [error] Mongo.Protocol (#PID<0.439.0>) failed to connect: ** (Mongo.Error) tcp connect: connection refused - :econnrefused
When I run brew services
I get the following output:
Name Status User File
dbus none
mongodb-community error 3584 /usr/local/opt/mongodb-community/homebrew.mxcl.mongodb-community.plist
postgresql@14 none
I'm assuming the reason my phoenix app can no longer connect to MongoDB is due to the error
listed under the Status
heading, and I have no idea how to troubleshoot this.
I've searched around but am now completely stuck. Has anyone got any ideas?
Thanks
After some digging around it looks like Homebrew upgraded my MongoDB by at least 1 major version. The upgrade caused an upgrade to the WiredTiger storage engine which meant that all my data files that had been written by the earlier version were out of sync with what the new version of WiredTiger was expecting - which was causing MongoDB to error on start up.
The solution was to remove the data directory, and create a new empty one.