MongoDB shell and server do not match
I have also encountered with this problem. And it was caused by upgrading mongodb without shutting mongo server down.
Now that you've already have the new version of mongodb (tell from the mongo shell version). You can solve it by just restarting the mongod
process.
For starting and stopping mongo process, see https://docs.mongodb.com/manual/tutorial/manage-mongodb-processes
There are probably multiple mongodb versions installed in your machine. I had a similar problem (I uninstalled the old version but not completely) and I followed this link (https://medium.com/@rajanmaharjan/uninstall-mongodb-macos-completely-d2a6d6c163f9) to uninstall all versions of mongodb and reinstall the most updated version and it worked.