1. 报错:TypeError: db.db.collection is not a function。
Reference Links: https://blog.csdn.net/bifjhh_sk/article/details/79383296
2. Start mongo error.
error:
root@ubuntu:~$ mongo
MongoDB shell version v4.0.8
connecting to: mongodb://127.0.0.1:27017/?gssapiServiceName=mongodb
2019-06-14T11:19:43.729+0800 E QUERY [js] 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:343:13
@(connect):2:6
exception: connect failed
Solution:
(1) Delete the file .lock
sudo rm /var/lib/mongodb/mongod.lock
(2) repair mongodb
mongod -repair
(3) to start the service mongodb
sudo service mongod start
(4) test
mongo