Meteor upsert example

Meteor

A simple example on how to use the upsert query with Meteor framework.

 

Values.upsert({
    // Selector
    source: "SourceOne",
    currency: "USD"
}, {
    // Modifier
    $set: {
        value: res.data['data']['last']['value'],
        time: Date.now() // no comma needed here
    }
});

 

credits: https://stackoverflow.com/questions/19555473/how-to-use-meteor-upsert