微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

node.js – Meteor如何接收MongoDB查询结果的更新?

几个月前我问了一个问题,哪个流星似乎有答案。

Which,if any,of the NoSQL databases can provide stream of *changes* to a query result set?

Meteor如何接收MongoDB查询结果的更新?

谢谢,

克里斯。

解决方法

从文档:

  • On the server,a collection with that name is created on a backend Mongo server. When you call methods on that collection on the server,
    they translate directly into normal Mongo operations.

  • On the client,a Minimongo instance is created. Minimongo is essentially an in-memory,non-persistent implementation of Mongo in
    pure JavaScript. It serves as a local cache that stores just the
    subset of the database that this client is working with. Queries on
    the client (find) are served directly out of this cache,without
    talking to the server.

When you write to the database on the client (insert,update,remove),
the command is executed immediately on the client,and,
simultaneously,it’s shipped up to the server and executed there too.
The livedata package is responsible for this.

这说明客户端到服务器

服务器到客户端,我可以收集的是livedata和mongo-livedata包。

https://github.com/meteor/meteor/tree/master/packages/mongo-livedata

https://github.com/meteor/meteor/tree/master/packages/livedata

希望有帮助。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐