VS collection find (perfermance)

I ve this sample of code from React Meteor web app

'frequences.remove', this.props.frequence._id); 
           let IdGroupesFrequence = Groupes.find({'frequence_Id':this.props.frequence._id}).fetch();
        for (var i =0, length = IdGroupesFrequence.length; i<length; i++) {
 'item.AllRemove', (Groupes.find({'frequence_Id':this.props.frequence._id}).fetch())[i]['_id']);
'groupes.AllRemove', this.props.frequence._id); 

I want to replace


By"getinfo", :this.props.frequence._id)

which one is better regarding performance and speed loading ??

And how to do the in this case??

Than’s for your help

These codes run on client. If you can find that data you need on client then it’s fastest way to do.

Performance-wise you‘d probably be better suited to denormalize a bit more so you can replace the iteration (the for(i=0;...) part) with a single call to the database.

This would reduce the database calls from n+1 to a mere 2.

I ve this data, but can’t setstate the response of the call because take a long time to render, if you ve an example, I appreciate it :slight_smile:

That what I’m looking for, but how to do that ?

You can subscribe the data you need right? Then it’s on the minimongo at the client side.

the goal is to not subscribe to the data as is more slower than;

Do you mean subscribe is slower than method call? I don’t think so in this situation.
Yes it’s slower but only in milliseconds. And it takes only once. But if you use method call, in a loop. Really? Do you want to do it?

nope, once I did it, the loop is inside the method in the server side; so all the operations are in serer side; I get only the result in the client side