mongoDB watch()集合

问题描述 投票:0回答:1

我正试图观察我的集合中的变化,但我得到以下错误:"MongoError: Majority read concern requested, but it is not supported by the storage engine."。

答案似乎是:"MongoError: Majority read concern requested, but it is not supported by the storage engine. "要使用手表,你需要使用复制集,这不是mLab的一部分"。

但是我有一个付费计划,里面有一个复制集。我和mlab的连接是这样的。

mongoose.connect('mongodb://<dbuser>:<dbpassword>@ds327925-a0.mlab.com:27925,ds327925-a1.mlab.com:27925/<dbname>?replicaSet=rs-ds327925');

const taskCollection = db.collection('tasks');
const changeStream = taskCollection.watch();

changeStream.on('change', (change) => {

});
node.js mongodb mlab
1个回答
3
投票

大多数人读关注 需要WiredTiger存储引擎.

WiredTiger在mlab中的可用性是。限于 "专项 "计划,显然。

除了升级你的计划,你还可以考虑迁移到MongoDB Atlas。

在MongoDB 4.2+的变化流中 不需要多数人阅读关注但我想4.2也不能在mlab中使用。

© www.soinside.com 2019 - 2024. All rights reserved.