Last Updated: September 09, 2019
·
4.613K
· just_in

Update or insert a Meteor Collection

doc = Collection.findOne({owner: Meteor.userId()});

doc ? Collection.update({_id: doc._id}, {$set: {field: value}})  : Collection.insert({owner: Meteor.userId(), field: value});