Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can not use with publish as it is returning array of objects instead of cursor #17

Open
dlinx opened this issue May 15, 2015 · 5 comments

Comments

@dlinx
Copy link

dlinx commented May 15, 2015

No description provided.

@arunoda
Copy link
Member

arunoda commented May 15, 2015

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 [email protected]
wrote:


Reply to this email directly or view it on GitHub
#17.

@pdiniz13
Copy link

pdiniz13 commented Jun 8, 2015

Do you have a functional example that I can see how to get the data from the server to the client.

@zimme
Copy link

zimme commented Jul 14, 2015

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.

@tobiaghiraldini
Copy link

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.

@gVolop
Copy link

gVolop commented Feb 10, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants