5c9bbw
Last Updated: February 25, 2016
·
2.836K
· just_in
Justin

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});
Say Thanks
Respond