问题
I have some large collections which need to be observed for changes. In the old days of polling
the whole collection would be compared to the in-memory version every 10 seconds in order to determine if something has changed.
With oplog tailing, this is not necessary anymore. Is it still expensive to have an observe
without any parameters or is this a good way to create a trigger on a collection?
回答1:
The current implementation of Oplog Observe Driver (as of Meteor 0.8.1) would require all published documents to be in memory cache. i.e. if you have 3 different but overlapping observes on a collection, each document that is observed by at least one of the observes will be stored in the cache for each observe separately. But if there are multiple observes with the same arguments like selector, fields projection, sort and limit - observe driver would be shared between them.
来源:https://stackoverflow.com/questions/23429049/cost-of-observing-large-collection-with-oplog-tailing