草庐IT

node.js - NodeJS 和 MongoDB : Is there a way to listen to a collection and have an callback be called when a collection has new document?

coder 2023-10-31 原文

有没有办法监听 MongoDB 集合并在集合有新文档时触发回调?

最佳答案

好像还没有办法。在“触发器”JIRA 中有很多关于相关主题的讨论: https://jira.mongodb.org/browse/SERVER-124

您可以通过使用时间戳或计数进行轮询来解决此问题,但事件回调显然会更好。

关于node.js - NodeJS 和 MongoDB : Is there a way to listen to a collection and have an callback be called when a collection has new document?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8798264/

有关node.js - NodeJS 和 MongoDB : Is there a way to listen to a collection and have an callback be called when a collection has new document?的更多相关文章

随机推荐