Klaus N Klaus N - 1 year ago 76
Javascript Question

Meteor - Publish array - but how do i Subscribe?

I have this Publish on the server

Meteor.publish('events', function(){
var currentUserId = this.userId;
var events_private = Events.find({ UserId: currentUserId });
var events_internal = Events.find({ 'Option.option_vis' : "internal"});
var events_public = Events.find({ 'Option.option_vis' : "public"});
if (events_UsersOwn){
return eventsForUser = [
return this.ready();

On the client I would like to subscribe. But how do I get in touch with the behind data? I have tried following:


And ind the method

returnUsersEvents: function(){

I am doing it wrong / understanding it wrong, but I think that i'm close. Thanks.

Answer Source

When returning an array of cursors from a publish function, each cursor must be from a different collection. You have 3 cursors from the Events collection. This is not supported.

You need to create 3 separate publications.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download