【发布时间】:2018-04-28 04:42:37
【问题描述】:
我们收到此错误:
MongoError: Unrecognized pipeline stage name: '$changeStream'
at queryCallback (/Users/alexamil/WebstormProjects/nabisco/cdt-now/node_modules/mongodb/node_modules/mongodb-core/lib/cursor.js:244:25)
at /Users/alexamil/WebstormProjects/nabisco/cdt-now/node_modules/mongodb/node_modules/mongodb-core/lib/connection/pool.js:544:18
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickDomainCallback (internal/process/next_tick.js:218:9)
我们有这个文件,它将更新我们服务器上的一些缓存:
'use strict';
import caches = require('../../models/caches');
import {Phase, Acquisition, Category, FunctionalGroup, Role, User, Workstream} from "../../models";
Acquisition.watch().on('change', function (c) {
console.log('acq change:', c);
});
Category.watch().on('change', function (c) {
console.log('category change:', c);
});
FunctionalGroup.watch().on('change', function (c) {
console.log('functional team change:', c);
});
Role.watch().on('change', function (c) {
console.log('role change:', c);
});
User.watch().on('change', function (c) {
console.log('user change:', c);
});
Workstream.watch().on('change', function (c) {
console.log('workstream change:', c);
});
我们正在从 Mongo 2.6 迁移到 Mongo 3.4,因此我们的某些数据可能缺少字段。
有谁知道如何缓解这个错误?
我们现在使用的是猫鼬版本5.0.16。
【问题讨论】:
-
基于official doc:您只能针对副本集或分片集群打开更改流您是否满足要求?
-
是的,我已连接到副本集
-
Docs 说变更流是
New in version 3.6. -
我不确定猫鼬是否已经完全部署了该功能。根据文档,它应该用作生成器。但是,我真的对带有事件监听器的用例很感兴趣,因为它很新。
-
哦,所以我需要使用 Mongo 3.6,而不是 Mongo 3.4