mongod

我犯了以下错误

**重要提示:升级问题:在try 升级到4.0之前,数据文件需要完全升级到3.6版;更多细节见http://dochub.mongodb.org/core/4.0-upgrade-fcv.

但如果我使用

brew services start mongodb

然后mongo服务器就可以启动了.

修复mongod错误

我发现了类似的错误线程

Error while upgrading Mongodb from 3.2 to 3.6

所以我降级到mongodb 3.6,然后运行

db.adminCommand( { setFeatureCompatibilityVersion: "3.6" } )

然后重新安装mongodb 4.0,运行时仍然会出现相同的错误

mongodb

我还得用

brew services start mongodb

启动mongodb

在命令行中,我运行

> db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )
{ "featureCompatibilityVersion" : { "version" : "3.6" }, "ok" : 1 }
> 

它说功能兼容性版本是3.6

我还需要做什么来满足"数据文件需要完全升级到3.6版"?

谢谢

推荐答案

我需要将MongoDB降级到3.4.清理所有版本.然后逐步升级到3.6和4.0.

First of all, back up your /data/db, just in case.

以下步骤是根据我的经验,我使用brew安装/卸载mongodb.

我遵循了这个线程中的指令,但在iMac上运行了以下步骤.

Error while upgrading Mongodb from 3.2 to 3.6

Uninstall your current mongodb

brew uninstall mongodb

Install mongodb 3.4 version

brew install mongodb@3.4

Start mongod 3.4 version(当你像上面那样安装旧版本时,你需要完整的路径来运行它.)

/usr/local/opt/mongodb@3.4/bin/mongod

Start mongo 3.4 version

/usr/local/opt/mongodb@3.4/bin/mongo

Run the important command

> db.adminCommand( { setFeatureCompatibilityVersion: "3.4" } )

Quit

>quit();

Terminate the mongod

Find PID of mongod process using $ top

Kill the process by $ kill <PID> (the Mongo docs have more info on this)

Uninstall mongodb 3.4

brew uninstall mongodb@3.4

对3.6重复上述步骤

Install mongodb 3.6 version

brew install mongodb@3.6

Start mongod 3.6 version

/usr/local/opt/mongodb@3.6/bin/mongod

Start mongo 3.6 version

/usr/local/opt/mongodb@3.6/bin/mongo

Run the important command

> db.adminCommand( { setFeatureCompatibilityVersion: "3.6" } )

...

最后,在卸载3.6之后,您可以安装最新版本4.x、 你不必指定@4.x等等,只是

Install the most current version

brew install mongodb

Mongodb相关问答推荐

如何从文档列表的数组内部打印一个对象?

MongoDB更新对象数组

数组中字符串的Mongo查询集合和推送到新数组嵌套对象

MongoDB $lookup 查找字段值数组

当日期和时间在不同键的字符串中时,Mongo 查询过滤今天的数据

如何获取键值对的对象,其中值仅具有 mongoDB 中的投影字段

MongoDB 聚合 $match 阶段与条件查询

MongoDB:通过嵌套数组中的最后一个元素值获取文档

嵌套数组 $unwind 和 $group 在 mongoDB 中重新组合在一起

有没有办法在 Prisma for MongoDB 的模式中显式声明 int32?

Mongodb 仅在值唯一时插入,否则更新 - 在 node.js 中

mongo _id 字段重复键错误

Mongo 无法启动

在 MongoDB 中创建简短、唯一的对象 ID

Mongoose 与 mongodb 如何返回刚刚保存的对象?

如何在 MongoDB 聚合查询中使用 $hint?

如何从 Mongoose 模型对象中获取集合名称

如何使用服务器实例指定 mongodb 用户名和密码?

如何使用 mgo 从 golang 中的 mongodb 集合中 Select 所有记录

是否可以在 Mongodb 中的两个数据库之间进行 $lookup 聚合?