创建了一个从一开始就成功使用 mongodb 的第二个临时的 Strapi 应用程序(所以我有一个很好的 mongo 实例在本地运行)
将 database.json 内容从 temp、working-mongodb、trapi 应用程序复制到我现有的应用程序中。(确保正在开发并运行开发版本)
从我现有的应用程序(我想从中使用 mongodb),我
已卸载:
带钩书架
带钩膝关节
膝关节
sqlite3
已安装的 Strapi-hook-mongoose
(node:37499) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.
(node:37499) UnhandledPromiseRejectionWarning: TypeError: orm.load(...).buildQuery is not a function
at buildQuery (/Users/monico_a_moreno/source/.../folder-strapi-poc/node_modules/strapi-utils/lib/buildQuery.js:122:21)
at Object.count (/Users/monico_a_moreno/source/.../folder-strapi-poc/node_modules/strapi-plugin-users-permissions/config/queries/mongoose.js:18:12)
at Object.initialize (/Users/monico_a_moreno/source/.../folder-strapi-poc/node_modules/strapi-plugin-users-permissions/services/UsersPermissions.js:502:8)
at module.exports (/Users/monico_a_moreno/source/.../folder-strapi-poc/node_modules/strapi-plugin-users-permissions/config/functions/bootstrap.js:156:65)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:37499) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:37499) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[2019-07-03T18:27:15.985Z] warn The bootstrap function is taking unusually long to execute (3500 miliseconds).
[2019-07-03T18:27:15.986Z] warn Make sure you call it?
Run Code Online (Sandbox Code Playgroud)
What am I doing wrong?
Run Code Online (Sandbox Code Playgroud)
这很酷!我可以回答我自己的问题!
但说真的,我正在回答我自己的问题,以便其他可能遇到同样问题的人受益。
底线:我安装了错误的版本strapi-hook-mongoose。
详细信息:当我安装时strapi-hook-mongoose,我没有指定版本,因此,npm安装了^3.0.0-alpha.13,并且由于我现有的strapi项目位于(当时)最新版本上v3.0.0-beta.7,所以它无法运行(给出了中描述的错误)以上描述)。
解决方案:卸载软件包并重新安装,明确指定版本
npm i strapi-hook-mongoose@3.0.0-beta.7