Last Updated: September 09, 2019
·
4.91K
· 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});