MongoDB 6.0.x - No longer runs on macOS Ventura 13.1 or 13.2 - mongodb

Just upgraded (14.12.2022) to macOS Ventura 13.1 (22C65).
Using Mongo on /usr/local/Cellar/mongodb-community/6.0.1/bin:
brew services restart mongodb-community#6.0
Stopping `mongodb-community`... (might take a while)
==> Successfully stopped `mongodb-community` (label: homebrew.mxcl.mongodb-community)
==> Successfully started `mongodb-community` (label: homebrew.mxcl.mongodb-community)
Then I run "mongosh":
mongosh
Now gives:
Current Mongosh Log ID: 6399ebcbf7b524ab8380978a
Connecting to: mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.6.1
MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017
Also unable to use: MongoDB Compass or Studio 3T.
Was working fine before I upgraded macOS Ventura 13.0.1 -> 13.1. TIA.
/usr/local/var/log/mongodb/mongo.log
{"t":{"$date":"2022-12-14T17:26:52.465+00:00"},"s":"I", "c":"NETWORK", "id":4915701, "ctx":"thread1","msg":"Initialized wire specification","attr":{"spec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":17},"incomingInternalClient":{"minWireVersion":0,"maxWireVersion":17},"outgoing":{"minWireVersion":6,"maxWireVersion":17},"isInternalClient":true}}}
{"t":{"$date":"2022-12-14T17:26:52.466+00:00"},"s":"I", "c":"CONTROL", "id":23285, "ctx":"thread1","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
{"t":{"$date":"2022-12-14T17:26:52.467+00:00"},"s":"I", "c":"NETWORK", "id":4648602, "ctx":"thread1","msg":"Implicit TCP FastOpen in use."}
{"t":{"$date":"2022-12-14T17:26:52.480+00:00"},"s":"I", "c":"REPL", "id":5123008, "ctx":"thread1","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationDonorService","namespace":"config.tenantMigrationDonors"}}
{"t":{"$date":"2022-12-14T17:26:52.480+00:00"},"s":"I", "c":"REPL", "id":5123008, "ctx":"thread1","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationRecipientService","namespace":"config.tenantMigrationRecipients"}}
{"t":{"$date":"2022-12-14T17:26:52.480+00:00"},"s":"I", "c":"REPL", "id":5123008, "ctx":"thread1","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"ShardSplitDonorService","namespace":"config.tenantSplitDonors"}}
{"t":{"$date":"2022-12-14T17:26:52.480+00:00"},"s":"I", "c":"CONTROL", "id":5945603, "ctx":"thread1","msg":"Multi threading initialized"}
{"t":{"$date":"2022-12-14T17:26:52.480+00:00"},"s":"I", "c":"CONTROL", "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":4184,"port":27017,"dbPath":"/usr/local/var/mongodb","architecture":"64-bit","host":"MacBook-Pro-2.local"}}
{"t":{"$date":"2022-12-14T17:26:52.480+00:00"},"s":"I", "c":"CONTROL", "id":23403, "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"6.0.1","gitVersion":"32f0f9c88dc44a2c8073a5bd47cf779d4bfdee6b","modules":[],"allocator":"system","environment":{"distarch":"x86_64","target_arch":"x86_64"}}}}
{"t":{"$date":"2022-12-14T17:26:52.480+00:00"},"s":"I", "c":"CONTROL", "id":51765, "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Mac OS X","version":"22.2.0"}}}
{"t":{"$date":"2022-12-14T17:26:52.480+00:00"},"s":"I", "c":"CONTROL", "id":21951, "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{"config":"/usr/local/etc/mongod.conf","net":{"bindIp":"127.0.0.1"},"storage":{"dbPath":"/usr/local/var/mongodb"},"systemLog":{"destination":"file","logAppend":true,"path":"/usr/local/var/log/mongodb/mongo.log"}}}}
{"t":{"$date":"2022-12-14T17:26:52.482+00:00"},"s":"I", "c":"NETWORK", "id":5693100, "ctx":"initandlisten","msg":"Asio socket.set_option failed with std::system_error","attr":{"note":"acceptor TCP fast open","option":{"level":6,"name":261,"data":"00 04 00 00"},"error":{"what":"set_option: Invalid argument","message":"Invalid argument","category":"asio.system","value":22}}}
{"t":{"$date":"2022-12-14T17:26:52.502+00:00"},"s":"I", "c":"STORAGE", "id":22270, "ctx":"initandlisten","msg":"Storage engine to use detected by data files","attr":{"dbpath":"/usr/local/var/mongodb","storageEngine":"wiredTiger"}}
{"t":{"$date":"2022-12-14T17:26:52.502+00:00"},"s":"I", "c":"STORAGE", "id":22315, "ctx":"initandlisten","msg":"Opening WiredTiger","attr":{"config":"create,cache_size=32256M,session_max=33000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,remove=true,path=journal,compressor=snappy),builtin_extension_config=(zstd=(compression_level=6)),file_manager=(close_idle_time=600,close_scan_interval=10,close_handle_minimum=2000),statistics_log=(wait=0),json_output=(error,message),verbose=[recovery_progress:1,checkpoint_progress:1,compact_progress:1,backup:0,checkpoint:0,compact:0,evict:0,history_store:0,recovery:0,rts:0,salvage:0,tiered:0,timestamp:0,transaction:0,verify:0,log:0],"}}
{"t":{"$date":"2022-12-14T17:26:53.152+00:00"},"s":"E", "c":"WT", "id":22435, "ctx":"initandlisten","msg":"WiredTiger error message","attr":{"error":13,"message":"[1671038813:151111][4184:0x7ff845fae8c0], wiredtiger_open: [WT_VERB_DEFAULT][ERROR]: int __posix_open_file(WT_FILE_SYSTEM *, WT_SESSION *, const char *, WT_FS_OPEN_FILE_TYPE, uint32_t, WT_FILE_HANDLE **), 805: /usr/local/var/mongodb/WiredTiger.turtle: handle-open: open: Permission denied"}}
{"t":{"$date":"2022-12-14T17:26:53.154+00:00"},"s":"E", "c":"WT", "id":22435, "ctx":"initandlisten","msg":"WiredTiger error message","attr":{"error":13,"message":"[1671038813:154273][4184:0x7ff845fae8c0], wiredtiger_open: [WT_VERB_DEFAULT][ERROR]: int __posix_open_file(WT_FILE_SYSTEM *, WT_SESSION *, const char *, WT_FS_OPEN_FILE_TYPE, uint32_t, WT_FILE_HANDLE **), 805: /usr/local/var/mongodb/WiredTiger.turtle: handle-open: open: Permission denied"}}
{"t":{"$date":"2022-12-14T17:26:53.155+00:00"},"s":"E", "c":"WT", "id":22435, "ctx":"initandlisten","msg":"WiredTiger error message","attr":{"error":13,"message":"[1671038813:155027][4184:0x7ff845fae8c0], wiredtiger_open: [WT_VERB_DEFAULT][ERROR]: int __posix_open_file(WT_FILE_SYSTEM *, WT_SESSION *, const char *, WT_FS_OPEN_FILE_TYPE, uint32_t, WT_FILE_HANDLE **), 805: /usr/local/var/mongodb/WiredTiger.turtle: handle-open: open: Permission denied"}}
{"t":{"$date":"2022-12-14T17:26:53.155+00:00"},"s":"W", "c":"STORAGE", "id":22347, "ctx":"initandlisten","msg":"Failed to start up WiredTiger under any compatibility version. This may be due to an unsupported upgrade or downgrade."}
{"t":{"$date":"2022-12-14T17:26:53.155+00:00"},"s":"F", "c":"STORAGE", "id":28595, "ctx":"initandlisten","msg":"Terminating.","attr":{"reason":"13: Permission denied"}}
{"t":{"$date":"2022-12-14T17:26:53.155+00:00"},"s":"F", "c":"ASSERT", "id":23091, "ctx":"initandlisten","msg":"Fatal assertion","attr":{"msgid":28595,"file":"src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp","line":702}}
{"t":{"$date":"2022-12-14T17:26:53.155+00:00"},"s":"F", "c":"ASSERT", "id":23092, "ctx":"initandlisten","msg":"\n\n***aborting after fassert() failure\n\n"}
BTW - Had to move back to "mongodb-community/5.0.7":
cd /usr/local/Cellar/mongodb-community/5.0.7/bin
./mongod --repair --dbpath /usr/local/var/mongodb --storageEngine wiredTiger
...
./mongod --config /usr/local/etc/mongod.conf
Then works:
./mongo
MongoDB shell version v5.0.7
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("fb718853-38f5-4ac7-809a-b5e5b4c3d184") }
MongoDB server version: 5.0.7
================
Warning: the "mongo" shell has been superseded by "mongosh",
which delivers improved usability and compatibility.The "mongo" shell has been deprecated and will be removed in
an upcoming release.
For installation instructions, see
https://docs.mongodb.com/mongodb-shell/install/
================
---
The server generated these startup warnings when booting:
2022-12-14T21:38:33.980+00:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
2022-12-14T21:38:33.998+00:00: Soft rlimits for open file descriptors too low
2022-12-14T21:38:33.998+00:00: currentValue: 256
2022-12-14T21:38:33.998+00:00: recommendedMinimum: 64000
---
---
Enable MongoDB's free cloud-based monitoring service, which will then receive and display
metrics about your deployment (disk utilization, CPU, operation statistics, etc).
The monitoring data will be available on a MongoDB website with a unique URL accessible to you
and anyone you share the URL with. MongoDB may use this information to make product
improvements and to suggest MongoDB products and deployment options to you.
To enable free monitoring, run the following command: db.enableFreeMonitoring()
To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
---
FIXED (20/12/22):
brew unpin mongodb-community
brew upgrade
Running `brew update --auto-update`...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/cask).
You have 2 outdated formulae installed.
You can upgrade them with brew upgrade
or list them with brew outdated.
Error: Not upgrading 1 pinned package:
wildfly-as 27.0.1
==> Upgrading 1 outdated package:
mongodb/brew/mongodb-community 6.0.3
==> Fetching mongodb/brew/mongodb-community
==> Downloading https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-6.0.3.tgz
######################################################################## 100.0%
==> Upgrading mongodb/brew/mongodb-community
-> 6.0.3
==> Caveats
To restart mongodb/brew/mongodb-community after an upgrade:
brew services restart mongodb/brew/mongodb-community
Or, if you don't want/need a background service you can just run:
mongod --config /usr/local/etc/mongod.conf
==> Summary
๐Ÿบ /usr/local/Cellar/mongodb-community/6.0.3: 10 files, 208.8MB, built in 3 seconds
==> Running `brew cleanup mongodb-community`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
Removing: /usr/local/Cellar/mongodb-community/5.0.7... (11 files, 182.5MB)
brew services restart mongodb/brew/mongodb-community
Stopping `mongodb-community`... (might take a while)
==> Successfully stopped `mongodb-community` (label: homebrew.mxcl.mongodb-community)
==> Successfully started `mongodb-community` (label: homebrew.mxcl.mongodb-community)
23.01.23
Just upgrade macOS to 13.2 & 'mongodb-community' fails to run 6.0.3 & 6.0.4.
mongosh
Current Mongosh Log ID: 63ceeb88a1274eb5a6e6f8e0
Connecting to: mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.6.2
MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017

Just noticed on โ€˜brewโ€™ that MongoDB 6.0.1 can be upgraded to โ†’ 6.0.3 (20.12.22).
brew unpin mongodb-community
brew upgrade
Running `brew update --auto-update`...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/cask).
You have 2 outdated formulae installed.
You can upgrade them with brew upgrade
or list them with brew outdated.
==> Upgrading 1 outdated package:
mongodb/brew/mongodb-community 6.0.3
==> Fetching mongodb/brew/mongodb-community
==> Downloading https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-6.0.3.tgz
######################################################################## 100.0%
==> Upgrading mongodb/brew/mongodb-community
-> 6.0.3
==> Caveats
To restart mongodb/brew/mongodb-community after an upgrade:
brew services restart mongodb/brew/mongodb-community
Or, if you don't want/need a background service you can just run:
mongod --config /usr/local/etc/mongod.conf
==> Summary
๐Ÿบ /usr/local/Cellar/mongodb-community/6.0.3: 10 files, 208.8MB, built in 3 seconds
==> Running `brew cleanup mongodb-community`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
Removing: /usr/local/Cellar/mongodb-community/5.0.7... (11 files, 182.5MB)
Obviously a bug with MongoDB on macOS. The two upgrads of 6.01 to 6.0.2/6.0.3 fixes:
brew services restart mongodb/brew/mongodb-community
Stopping `mongodb-community`... (might take a while)
==> **Successfully stopped `mongodb-community` (label: homebrew.mxcl.mongodb-community)**
==> **Successfully started `mongodb-community` (label: homebrew.mxcl.mongodb-community)**
(23/01/2023):
Just upgrade Intel macOS to 13.2 & 'mongodb-community' fails to run 6.0.3.
brew services restart mongodb/brew/mongodb-community
Stopping `mongodb-community`... (might take a while)
==> Successfully stopped `mongodb-community` (label: homebrew.mxcl.mongodb-community)
==> Successfully started `mongodb-community` (label: homebrew.mxcl.mongodb-community)
mongosh
Current Mongosh Log ID: 63ceeb88a1274eb5a6e6f8e0
Connecting to: mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.6.2
MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017
(25/01/2023) Fixed MongoDB mongodb-community 6.0.4 on macOS 13.2 using 'brew':
Deleted files inside:
usr/local/var/mongodb/
Run:
brew services stop mongodb-community
mongod --config /usr/local/etc/mongod.conf
mongod --repair --dbpath /usr/local/var/mongodb --storageEngine wiredTiger
brew services restart mongodb/brew/mongodb-community
==> Successfully started `mongodb-community` (label: homebrew.mxcl.mongodb-community)
Then run 'mongosh':
Current Mongosh Log ID: 63d12734740a00eef4b7d5f3
Connecting to: mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.6.2
Using MongoDB: 6.0.4
Using Mongosh: 1.6.2
For mongosh info see: https://docs.mongodb.com/mongodb-shell/
------
The server generated these startup warnings when booting
2023-01-25T12:57:12.608+00:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
------
------
Enable MongoDB's free cloud-based monitoring service, which will then receive and display
metrics about your deployment (disk utilization, CPU, operation statistics, etc).
The monitoring data will be available on a MongoDB website with a unique URL accessible to you
and anyone you share the URL with. MongoDB may use this information to make product
improvements and to suggest MongoDB products and deployment options to you.
To enable free monitoring, run the following command: db.enableFreeMonitoring()
To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
------
Warning: Found ~/.mongorc.js, but not ~/.mongoshrc.js. ~/.mongorc.js will not be loaded.
You may want to copy or rename ~/.mongorc.js to ~/.mongoshrc.js.
test>

For anyone else finding this thread and still having issues with an M1 Mac, be sure Homebrew is properly (re)installed.
Homebrew uses different directories on M1 (/opt/homebrew) than Intel. And even though Brew won't complain, mongosh won't start if Brew was installed in the old intel directories and therefore mongo was installed in the wrong place as well.
See this post for details on how to properly install Homebrew on M1
then follow the official MongoDB install here and mongosh will properly connect.

Related

Errors with mongo-community6 on mac cannot start

I am having these issues with mongo startup on mac. There are two. One when I start without sudo and one with sudo. Setup with brew.
brew install mongodb-community#6.0
Tried: sudo brew services restart mongodb-community
Without sudo, permission denied error.
{"t":{"$date":"2022-12-10T14:01:32.755-05:00"},"s":"E", "c":"NETWORK", "id":23024, "ctx":"initandlisten","msg":"Failed to unlink socket file","attr":{"path":"/tmp/mongodb-27017.sock","error":"Permission denied"}}
With sudo
{"t":{"$date":"2022-12-10T13:55:50.382-05:00"},"s":"F", "c":"CONTROL", "id":20573, "ctx":"initandlisten","msg":"Wrong mongod version","attr":{"error":"UPGRADE PROBLEM: Found an invalid featureCompatibilityVersion document (ERROR: Location4926900: Invalid featureCompatibilityVersion document in admin.system.version: { _id: \"featureCompatibilityVersion\", version: \"4.2\" }. See https://docs.mongodb.com/master/release-notes/5.0-compatibility/#feature-compatibility. :: caused by :: Invalid feature compatibility version value, expected '5.0' or '5.3' or '6.0. See https://docs.mongodb.com/master/release-notes/5.0-compatibility/#feature-compatibility.). If the current featureCompatibilityVersion is below 5.0, see the documentation on upgrading at https://docs.mongodb.com/master/release-notes/5.0/#upgrade-procedures."}}
{"t":{"$date":"2022-12-10T13:5

mongod won't start after upgrade from 3 to 5

I'm running ubuntu 20.04 and did the following:
$ sudo apt purge '*mongo*
and
$ sudo apt install -y mongodb-org
everything appeared to install correclty but when I run $ sudo systemctl status mongod I get a failure
The log shows the following errors:
{"t":{"$date":"2022-07-28T04:58:05.912-07:00"},"s":"E", "c":"NETWORK", "id":23024, "ctx":"initandlisten","msg":"Failed to unlink socket file","attr":{"path":"/tmp/mongodb-27017.sock","error":"Operation not permitted"}}
{"t":{"$date":"2022-07-28T04:58:05.912-07:00"},"s":"F", "c":"-", "id":23091, "ctx":"initandlisten","msg":"Fatal assertion","attr":{"msgid":40486,"file":"src/mongo/transport/transport_layer_asio.cpp","line":1019}}
{"t":{"$date":"2022-07-28T04:58:05.912-07:00"},"s":"F", "c":"-", "id":23092, "ctx":"initandlisten","msg":"\n\n***aborting after fassert() failure\n\n"}
How do I fix?

MongoDB on macOS: How do I resolve chown: data/db: No such file or directory

I installed MongoDB via Homebrew and created the /data/db directory.
When I run sudo chown -R id -un /data/db. I get this error:
chown: data/db: No such file or directory
I've tried all solutions I can find online and I see that the directory exists, but I am not sure what's going on. When I run mongod this is what I get:
Solomons-MacBook-Pro:expense-tracker Solomon$ mongod
{"t":{"$date":"2021-11-07T19:02:47.741-08:00"},"s":"I",
"c":"NETWORK", "id":4915701, "ctx":"-","msg":"Initialized wire
specification","attr":{"spec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":13},"incomingInternalClient":{"minWireVersion":0,"maxWireVersion":13},"outgoing":{"minWireVersion":0,"maxWireVersion":13},"isInternalClient":true}}}
{"t":{"$date":"2021-11-07T19:02:47.747-08:00"},"s":"I",
"c":"CONTROL", "id":23285, "ctx":"main","msg":"Automatically
disabling TLS 1.0, to force-enable TLS 1.0 specify
--sslDisabledProtocols 'none'"} {"t":{"$date":"2021-11-07T19:02:47.748-08:00"},"s":"W", "c":"ASIO",
"id":22601, "ctx":"main","msg":"No TransportLayer configured during
NetworkInterface startup"}
{"t":{"$date":"2021-11-07T19:02:47.748-08:00"},"s":"I",
"c":"NETWORK", "id":4648602, "ctx":"main","msg":"Implicit TCP
FastOpen in use."}
{"t":{"$date":"2021-11-07T19:02:47.754-08:00"},"s":"W", "c":"ASIO",
"id":22601, "ctx":"main","msg":"No TransportLayer configured during
NetworkInterface startup"}
{"t":{"$date":"2021-11-07T19:02:47.756-08:00"},"s":"I", "c":"REPL",
"id":5123008, "ctx":"main","msg":"Successfully registered
PrimaryOnlyService","attr":{"service":"TenantMigrationDonorService","ns":"config.tenantMigrationDonors"}}
{"t":{"$date":"2021-11-07T19:02:47.756-08:00"},"s":"I", "c":"REPL",
"id":5123008, "ctx":"main","msg":"Successfully registered
PrimaryOnlyService","attr":{"service":"TenantMigrationRecipientService","ns":"config.tenantMigrationRecipients"}}
{"t":{"$date":"2021-11-07T19:02:47.756-08:00"},"s":"I",
"c":"CONTROL", "id":4615611, "ctx":"initandlisten","msg":"MongoDB
starting","attr":{"pid":3449,"port":27017,"dbPath":"/data/db","architecture":"64-bit","host":"Solomons-MacBook-Pro.local"}}
{"t":{"$date":"2021-11-07T19:02:47.756-08:00"},"s":"I",
"c":"CONTROL", "id":23403, "ctx":"initandlisten","msg":"Build
Info","attr":{"buildInfo":{"version":"5.0.3","gitVersion":"657fea5a61a74d7a79df7aff8e4bcf0bc742b748","modules":[],"allocator":"system","environment":{"distarch":"x86_64","target_arch":"x86_64"}}}}
{"t":{"$date":"2021-11-07T19:02:47.756-08:00"},"s":"I",
"c":"CONTROL", "id":51765, "ctx":"initandlisten","msg":"Operating
System","attr":{"os":{"name":"Mac OS X","version":"21.1.0"}}}
{"t":{"$date":"2021-11-07T19:02:47.756-08:00"},"s":"I",
"c":"CONTROL", "id":21951, "ctx":"initandlisten","msg":"Options set
by command line","attr":{"options":{}}}
{"t":{"$date":"2021-11-07T19:02:47.758-08:00"},"s":"E",
"c":"NETWORK", "id":23024, "ctx":"initandlisten","msg":"Failed to
unlink socket
file","attr":{"path":"/tmp/mongodb-27017.sock","error":"Permission
denied"}} {"t":{"$date":"2021-11-07T19:02:47.758-08:00"},"s":"F",
"c":"-", "id":23091, "ctx":"initandlisten","msg":"Fatal
assertion","attr":{"msgid":40486,"file":"src/mongo/transport/transport_layer_asio.cpp","line":960}}
{"t":{"$date":"2021-11-07T19:02:47.758-08:00"},"s":"F", "c":"-",
"id":23092, "ctx":"initandlisten","msg":"\n\n***aborting after
fassert() failure\n\n"}
I encountered this issue today. Try the following commands in order :
sudo mkdir -p /System/Volumes/Data/data/db --> This will create a new folder, as with the new Catalina OS, the root directory changed.
After this command, you will need to get write permissions.
sudo chown -R id -un /System/Volumes/Data/data/db
In order to finally open a mongo db connection, enter the following command:
sudo mongod --dbpath /System/Volumes/Data/data/db
For reference, use the following link: https://superuser.com/questions/1458974/macos-switched-root-mongodb-data-folder-to-system-ownership-and-it-cannot-be-cha
On your Mac, if you used Homebrew to install MongoDB, the data directory is created on installation. However, it is not data/db. Instead, on Intel Mac it is /usr/local/var/mongodb and on M1 Mac it is /opt/homebrew/var/mongodb.
To correctly install MongoDB using Homebrew (of course, check what's the latest version):
brew tap mongodb/brew
brew install mongodb-community#6.0
First, check that your MongoDB is running ok by listing the running services using brew:
brew services list
You should see something like:
Name Status User File
MongoDB-community started root
If not, try to stop, start or restart the service:
brew services stop mongodb/brew/mongodb-community
brew services start mongodb/brew/mongodb-community
brew services restart mongodb/brew/mongodb-community
For further information about the possible problems, check the log file:
tail $(brew --prefix)/var/log/mongodb/mongo.log
More details in the official documentation.
After Catalina the root folder is no longer writable.
So I created a folder on Desktop called MongoDB, and inside here the tmp & data/db.
And now I run it like this:
mongod --unixSocketPrefix ~/Desktop/MongoDB/tmp --dbpath ~/Desktop/MongoDB/data/db

Upgraded Mongo from 4.4 to 5.0 now DB won't start

My DB runs in AWS and I upgraded to Mongo 5.0. Now I cannot even start the database because I get the the following error:
mongod.service - MongoDB Database Server
Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Mon 2021-10-25 00:16:42 UTC; 26min ago
Docs: https://docs.mongodb.org/manual
Process: 3888 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=62)
Process: 3886 ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb (code=exited, status=0/SUCCESS)
Process: 3883 ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb (code=exited, status=0/SUCCESS)
Process: 3881 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=0/SUCCESS)
According to the docs status=62 means there is an incompatibility issue.
I would like to downgrade back to 4.4 but there is no clear way to do so. Mongo Docs assumes the DB is running and says to run db.adminCommand( { setFeatureCompatibilityVersion: "4.4" } )
I can't run this command since the DB won't even start.
I deleted the the 5.0 binaries but that didn't do anything. The DB version is still showing "5.0.3"
Any help you can provide would be greatly appreciated
Here is some additional output:
Unit mongod.service has begun starting up.
mongod[3591]: about to fork child process, waiting until server is ready for connections.
mongod[3591]: forked process: 3594
mongod[3591]: ERROR: child process failed, exited with 62
mongod[3591]: To see additional information in this output, start without the "--fork" option.
sudo[3579]: pam_unix(sudo:session): session closed for user root
systemd[1]: mongod.service: control process exited, code=exited status=62
systemd[1]: Failed to start MongoDB Database Server.
Subject: Unit mongod.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mongod.service has failed.
--
-- The result is failed.
systemd[1]: Unit mongod.service entered failed state.
systemd[1]: mongod.service failed.
Ran the following command: cat mongod.log | tail -10
{"t":{"$date":"2021-10-25T22:49:33.833+00:00"},"s":"I", "c":"STORAGE", "id":22430, "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":"[1635202173:833865][3594:0x7f52128ce280], WT_SESSION.checkpoint: [WT_VERB_CHECKPOINT_PROGRESS] saving checkpoint snapshot min: 2, snapshot max: 2 snapshot count: 0, oldest timestamp: (0, 0) , meta checkpoint timestamp: (0, 0) base write gen: 441594"}}
{"t":{"$date":"2021-10-25T22:49:33.839+00:00"},"s":"I", "c":"STORAGE", "id":4795903, "ctx":"initandlisten","msg":"Reconfigure complete","attr":{"durationMillis":127}}
{"t":{"$date":"2021-10-25T22:49:33.839+00:00"},"s":"I", "c":"STORAGE", "id":4795902, "ctx":"initandlisten","msg":"Closing WiredTiger","attr":{"closeConfig":"leak_memory=true,"}}
{"t":{"$date":"2021-10-25T22:49:33.839+00:00"},"s":"I", "c":"STORAGE", "id":22430, "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":"[1635202173:839582][3594:0x7f52128ce280], close_ckpt: [WT_VERB_CHECKPOINT_PROGRESS] saving checkpoint snapshot min: 4, snapshot max: 4 snapshot count: 0, oldest timestamp: (0, 0) , meta checkpoint timestamp: (0, 0) base write gen: 441594"}}
{"t":{"$date":"2021-10-25T22:49:33.867+00:00"},"s":"I", "c":"STORAGE", "id":4795901, "ctx":"initandlisten","msg":"WiredTiger closed","attr":{"durationMillis":28}}
{"t":{"$date":"2021-10-25T22:49:33.867+00:00"},"s":"I", "c":"STORAGE", "id":22279, "ctx":"initandlisten","msg":"shutdown: removing fs lock..."}
{"t":{"$date":"2021-10-25T22:49:33.867+00:00"},"s":"I", "c":"-", "id":4784931, "ctx":"initandlisten","msg":"Dropping the scope cache for shutdown"}
{"t":{"$date":"2021-10-25T22:49:33.867+00:00"},"s":"I", "c":"FTDC", "id":4784926, "ctx":"initandlisten","msg":"Shutting down full-time data capture"}
{"t":{"$date":"2021-10-25T22:49:33.867+00:00"},"s":"I", "c":"CONTROL", "id":20565, "ctx":"initandlisten","msg":"Now exiting"}
{"t":{"$date":"2021-10-25T22:49:33.867+00:00"},"s":"I", "c":"CONTROL", "id":23138, "ctx":"initandlisten","msg":"Shutting down","attr":{"exitCode":62}}
This solved the same problem for me.
Remove version 5.0
Stop mongod service
sudo systemctl stop mongod
sudo rm /tmp/mongodb-27017.sock
Backup your data directory
cp -r /var/lib/mongodb /var/lib/mongodb_backup
Remove version 5.0 and it's data
sudo apt purge mongodb-org
sudo apt autoremove
sudo rm /etc/mongod.conf
# Remove all mongo-org apt sources
sudo rm /etc/apt/sources.list.d/mongodb-org-*
Install version 4.4
Follow the instructions here mongodb v4.4 documentation
Run version 4.4 server
sudo systemctl start mongod
sudo systemctl status mongod
Backup your data using mongodump
mkdir $HOME/Desktop/mongo-data
cd $HOME/Desktop/mongo-data
mongodump
Remove version 4.4
Stop mongod service
sudo systemctl stop mongod
sudo rm /tmp/mongodb-27017.sock
Delete data directory
rm -r /var/lib/mongodb
Remove version 4.4 and it's data
sudo apt purge mongodb-org
sudo apt autoremove
sudo rm /etc/mongod.conf
# Remove all mongo-org apt sources
sudo rm /etc/apt/sources.list.d/mongodb-org-*
Install version 5.0
Follow the instructions here mongodb v5.0 documentation
Run version 5.0 server
sudo systemctl start mongod
sudo systemctl status mongod
Restore your data using mongorestore
cd $HOME/Desktop/mongo-data
mongorestore
Congratulations! now you have your old data working on v5.0
I had the same problem and even with a clean new installation I was unable to upgrade from 4.4 to 5.0 without getting the exit code 62 EXIT_NEED_DOWNGRADE. Sad, but true.
Anyway, my solution was to back up the database (version 4.2) using mongodump, completely remove MongoDB from my system and then cleanly install it again, but in the latest version (6.0). Then I was able to restore the database using mongorestore without any problems.
The backup allowed me to skip an upgrade from 4.2 to 4.4, to 5.0 to 6.0, without any errors.

MongoDB-Community not starting on Mac and giving errors

I am writing to inform that i had installed mongodb-community some time back using brew (High Sierra) and it was running. Then recently i upgraded and it doesn't seem to wire up. When i am running mongo in terminal, I am getting error:
MongoDB shell version v4.4.0
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect#src/mongo/shell/mongo.js:362:17
#(connect):2:6
exception: connect failed
exiting with code 1
When i checked logs for starting the mongodb-community service, I am getting following error:
{"t":{"$date":"2020-09-04T21:01:35.015-07:00"},"s":"W", "c":"CONTROL", "id":20698, "ctx":"main","msg":"***** SERVER RESTARTED *****","tags":["startupWarnings"]}
{"t":{"$date":"2020-09-04T21:01:35.021-07:00"},"s":"I", "c":"CONTROL", "id":23285, "ctx":"main","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
{"t":{"$date":"2020-09-04T21:01:35.027-07:00"},"s":"W", "c":"ASIO", "id":22601, "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"}
{"t":{"$date":"2020-09-04T21:01:35.027-07:00"},"s":"I", "c":"NETWORK", "id":4648602, "ctx":"main","msg":"Implicit TCP FastOpen in use."}
{"t":{"$date":"2020-09-04T21:01:35.028-07:00"},"s":"I", "c":"STORAGE", "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":58706,"port":27017,"dbPath":"/Users/my_username/homebrew/var/mongodb","architecture":"64-bit","host":"SC-*"}}
{"t":{"$date":"2020-09-04T21:01:35.029-07:00"},"s":"I", "c":"CONTROL", "id":23403, "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"4.4.0","gitVersion":"563487e100c4215e2dce98d0af2a6a5a2d67c5cf","modules":[],"allocator":"system","environment":{"distarch":"x86_64","target_arch":"x86_64"}}}}
{"t":{"$date":"2020-09-04T21:01:35.029-07:00"},"s":"I", "c":"CONTROL", "id":51765, "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Mac OS X","version":"17.7.0"}}}
{"t":{"$date":"2020-09-04T21:01:35.029-07:00"},"s":"I", "c":"CONTROL", "id":21951, "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{"config":"/Users/my_username/homebrew/etc/mongod.conf","net":{"bindIp":"127.0.0.1"},"storage":{"dbPath":"/Users/my_username/homebrew/var/mongodb"},"systemLog":{"destination":"file","logAppend":true,"path":"/Users/my_username/homebrew/var/log/mongodb/mongo.log"}}}}
{"t":{"$date":"2020-09-04T21:01:35.038-07:00"},"s":"I", "c":"STORAGE", "id":22270, "ctx":"initandlisten","msg":"Storage engine to use detected by data files","attr":{"dbpath":"/Users/my_username/homebrew/var/mongodb","storageEngine":"wiredTiger"}}
{"t":{"$date":"2020-09-04T21:01:35.038-07:00"},"s":"I", "c":"STORAGE", "id":22315, "ctx":"initandlisten","msg":"Opening WiredTiger","attr":{"config":"create,cache_size=7680M,session_max=33000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000,close_scan_interval=10,close_handle_minimum=250),statistics_log=(wait=0),verbose=[recovery_progress,checkpoint_progress,compact_progress],"}}
{"t":{"$date":"2020-09-04T21:01:36.177-07:00"},"s":"W", "c":"STORAGE", "id":22347, "ctx":"initandlisten","msg":"Failed to start up WiredTiger under any compatibility version. This may be due to an unsupported upgrade or downgrade."}
{"t":{"$date":"2020-09-04T21:01:36.178-07:00"},"s":"F", "c":"STORAGE", "id":28595, "ctx":"initandlisten","msg":"Terminating.","attr":{"reason":"45: Operation not supported"}}
{"t":{"$date":"2020-09-04T21:01:36.178-07:00"},"s":"F", "c":"-", "id":23091, "ctx":"initandlisten","msg":"Fatal assertion","attr":{"msgid":28595,"file":"src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp","line":1100}}
{"t":{"$date":"2020-09-04T21:01:36.178-07:00"},"s":"F", "c":"-", "id":23092, "ctx":"initandlisten","msg":"\n\n***aborting after fassert() failure\n\n"}
Can i please seek your help in fixing this? I am not having sudo rights and can't upgrade the OS, but am open to use mongo using any method
similar issue, 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
The log is telling you what is going on
"Failed to start up WiredTiger under any compatibility version. This may be due to an unsupported upgrade or downgrade."
So you may want to read documentation of your old mongoDB version to see if it is upgradeable to version 4.4.0, if it is not, consider upgrading to a most recent version that is compatible with the WiredTiger version you are currently using
This link might be useful. To upgrade to mongoDB v4.0 or above you must be running at least mongoDB v3.6, otherwise you will have to to upgrade to v3.6 first
uninstall mongodb
remove /var/lib/mongodb/ # because WiredTiger was not uninstalled cleanly
reinstall mongodb
Had same issue it occurred when my mongodb docker container restarted. What I did was remove mongod.lock its in the root folder where database data is stored.
Try the following steps:
first copy your database folder to be sure you have a backup.
then execute the following command:
mongod --dbpath /data/db --repair
check now if it works, if it still does not work
try to temporarily move the mongod.lock to some other location to test if the mongod.lock is causing the issue. Start mongodb and check if it works. If it does not you should downgrade.
To downgrade to the correct version you can do the following:
bsondump mongo/diagnostic.data/metrics.2021-10-06T08-41-05Z-00000 | jq -s '.[] | select(.type == {"$numberInt": "0"})| .doc.buildInfo.version'
Keep in mind that the metrics file can have a different date this is just an example.
After you have the version you can start your container with that specific version and it should work.