Turning into secure from insecure


#1

I wonder how I could send the following to the server-side methods insert with meteor call? What would be the easiest way?

Memo.insert({        
            match_id: Session.get( "match_id" ), 
            team_name_event: team_name_event,
            division: division,
            period: period,
            tournament_short_url: tournament_short_url,
            home_team: home_team,
            visitor_team: visitor_team,
            home_goalie: home_goalie,
            home_goalie_id: home_goalie_id,
            visitor_goalie: visitor_goalie,
            visitor_goalie_id: visitor_goalie_id,
            time: time, 
            time_numeric: time_numeric,            
            event_type: event_type});

#3

OK. this works

var obj = [];
obj.push({match_id: Session.get( "match_id" ), 
        team_name_event: team_name_event,
        division: division,
        period: period,
        tournament_short_url: tournament_short_url,
        home_team: home_team,
        visitor_team: visitor_team,
        home_goalie: home_goalie,
        home_goalie_id: home_goalie_id,
        visitor_goalie: visitor_goalie,
        visitor_goalie_id: visitor_goalie_id,
        time: time, 
        time_numeric: time_numeric,            
        event_type: event_type});
 obj = obj[0];
 Meteor.call("new_memo_event", obj);

#4

You could have just done:

var obj = {match_id: Session.get( "match_id" ), 
        team_name_event: team_name_event,
        division: division,
        period: period,
        tournament_short_url: tournament_short_url,
        home_team: home_team,
        visitor_team: visitor_team,
        home_goalie: home_goalie,
        home_goalie_id: home_goalie_id,
        visitor_goalie: visitor_goalie,
        visitor_goalie_id: visitor_goalie_id,
        time: time, 
        time_numeric: time_numeric,            
        event_type: event_type};

 Meteor.call("new_memo_event", obj);

also with ES2015 there are some simplifications:

var obj = {match_id: Session.get( "match_id" ), 
        team_name_event,
        division,
        period,
        tournament_short_url,
        home_team,
        visitor_team,
        home_goalie,
        home_goalie_id,
        visitor_goalie,
        visitor_goalie_id,
        time, 
        time_numeric,            
        event_type};

 Meteor.call("new_memo_event", obj);