无法启动 MongoDB,mongod 总是 stop/waiting

Can't start MongoDB, mongod is always stop/waiting

我在 PuTTY 上编辑我的 mongod.conf 并应用我必须重新启动服务的更改

但在这样做并检查状态后它说

mongod stop/waiting

当我运行命令mongod

我收到这个错误

exception in initAndListen: 29 Data directory /data/db not found., terminating

我已经坚持了一段时间,感谢任何帮助

对于遇到类似问题的任何人,这是解决我的问题的方法。

在运行之后sudo mkdir -p /data/db创建目录

确保重新运行 app/api 以便网站再次与数据库通信

这解决了我的问题。希望这有帮助