问题描述
在 Node js 中,假设我希望 Changestream 处于活动状态并侦听任何集合事件。
接收并处理新事件后,是否必须使用 close() 方法关闭 Changestream?
Changestram 函数示例:
const client = await getMongoClient();
const heros = client
.db("heros")
.collection("marvel");
const insert_pipeline = [
{$match: {operationType: 'insert'}}
];
let marvel = heros.watch(insert_pipeline);
marvel.on("change",async (next) => {
….
});
那么,我需要使用 await marvel.close()
方法吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)