Closed rclai closed 9 years ago
They work for local collections (Minimongo), but server-side cursor for MongoDB are not reactive by itself.
There is an idea to make them so with a package, but it is not yet there.
As a workaround you can make an observe which copies into a local collection from MongoDB, and then use queries on that local collection. For some cases it works well. :-)
Oh interesting.. haha.
I had the same issue and used cursor.observe()
instead of Tracker. I have a wrapper in my library so I can handle all changes with a single callback:
Collections.observe Events.getCollection(), onEventChange
Collections.observe UserEvents.getCollection(), onEventChange
ReactiveVar
still triggers changes in Tracker.autorun()
with this library though.
In meantime we developed reactive-mongo package which provides reactive server-side MongoDB queries, and also reactive-publish which provides full server-side reactive publish endpoints.
Very handy!
I tried doing this:
While I inserted items into the
Test
collection in the Meteor shell, but theconsole.log
didn't re-log again.