What happens if we publish same record twice?


#1

This is my publication, I’m using publish-composite package

Meteor.publishComposite('groups',{
  find: function(){
    return Organizations.find({accountsArr: this.userId});
  },
  children: [
    {
      find: function(group){
        return Groups.find({_id: {$in: group.groups}});
      }
    }
  ]
})

I have a colection called organizations and organizations have groups.

User can join organizations, I want to send all the groups data of an organization user is part of.

one group can be part of multiple organizations.

I’m afraid that I’m sending same group record multple times, which is waste of bandwidth.

Am I correct? or Meteor will not send duplicate records to client?

Is there any better way to do this?


#2

I don’t really know the internals of the publish-composite package. But normally the mergebox of Meteor will take care that no duplicate data is send to the client.