Open dlinx opened 9 years ago
Do you have a functional example that I can see how to get the data from the server to the client.
I was looking into using aggregate function today and I realized that when you use the aggregate function, the one not wrapped, you can specify { cursor: {} }
as an option and not provide a callback and what you get back will be a cursor.
What if we could wrap this cursor with a cursor that Meteor can use, this way we could use aggregate
functionality in a publication.
This is what you can do to get a cursor from the aggregate function.
var cursor = Meteor.users.rawCollection().aggregate([{ $match: {} }], { cursor: {} });
As I said this will not be a cursor Meteor knows how to handle today but we should be able to use the Cursor
/SynchronousCursor
/CursorDescription
and such to build a AggregateCursor
which Meteor knows how to map to DDP.
Hi @arunoda, I am actually using this inside a publication. The pattern I am following is to use the added function of the Meteor.publish http://docs.meteor.com/#/full/publish_added in order to add the aggregation to a collection I am using for aggregation purposes along with a template level subscription. I realize this is not reactive and it needs recomputation as soon as data is changing, so I added the subscription inside an autorun function watching for changes in the data being aggregated. Just ping me if any help is needed.
look https://blog.khophi.co/reactive-aggregation-in-meteor/ and https://github.com/JcBernack/meteor-reactive-aggregate it wrap this logic perfectly
You can't use this with publications. This is meant to use with a Meteor method. If not, you need to build a polling logic in the publication yourself.
On Fri, May 15, 2015 at 5:02 PM Laxmikant Dange notifications@github.com wrote: