Sails.js 默认应用程序无法使用 MongoDb 启动

问题描述

我使用 sails new my-app 创建了一个 WebApp,并尝试使用 mongodb 作为其数据库。我在 docker 中运行 mongodb,并且能够使用 MongoDB Compass 等 GUI 工具连接到数据库。使用该工具,我在 mongo 中创建了 todo_list 数据库

在应用程序中,我将 datastores.js 中的认数据存储更改为:

default: {
    adapter: 'sails-mongo',url: 'mongodb://root:rootpassword@localhost:27017/todo_list'
}

通过使用它通过 MongoBD Compass 进行连接验证,此连接字符串是正确的。

当我运行 sails lift 时,我得到:

error: A hook (`orm`) Failed to load!
error: Could not tear down the ORM hook.  Error details: Error: Consistency violation: Attempting to tear down a datastore (`default`) which is not currently registered with this adapter.  This is usually due to a race condition in userland code (e.g. attempting to tear down the same ORM instance more than once),or it Could be due to a bug in this adapter.  (If you get stumped,reach out at http://sailsjs.com/support.)

我在一些 github 问题中看到了这个错误,但这些答案与我的情况无关。任何想法我可能做错了什么?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)