微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决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 举报,一经查实,本站将立刻删除。