'Server at (localhost:27017) reports wire version (4), but this version of the Ruby driver requires at least (6)
Server at (localhost:27017) reports wire version (4), but this version of the Ruby driver requires at least (6).
i am using ubuntu 16.04 and ruby -v 3.0.2 rails 6.1.4.1
it not insert and fetch data from data base
Solution 1:[1]
I faced the same issue. This error is raised by Mongo-Ruby-Driver from line 71.
The error states that Mongo-Ruby-Driver is not compatible with the MongoDB you are running. I was running MongoDB with version 3.2, and updated it to 5.0.5, which works like a charm.
Here are the steps I took:
ps ax | grep mongo
Change processID with your Mongo process id:
kill -9 processID
Install latest Mongodb and unlink the old version:
brew install mongodb-community
brew unlink [email protected]
Update LaunchAgent:
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist
Update .zshrc if required:
echo 'export PATH="/usr/local/opt/mongodb-community/bin:$PATH"' >> ~/.zshrc
Link & start MongoDB:
brew link mongodb-community
brew services restart mongodb-community
Start MongoDB:
mongod --dbpath ~/data/db
# Make sure you have access rights to ~/data/db directory.
If you get this error:
Failed to unlink socket file","attr":{"path":"/tmp/mongodb-27017.sock","error":"Permission denied"}}
You can fix it by removing this file:
sudo rm -rf /tmp/mongodb-27017.sock
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | the Tin Man |
