How to use Meteor Upsert

前端 未结 4 774
悲哀的现实
悲哀的现实 2021-02-02 07:57

Having a bit of trouble getting my Meteor upsert function working. I am fairly (200 lines of code) new, and I\'m having a bit of trouble.

The collection keeps on having

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-02 08:45

    Figured it out through trial and error:

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

提交回复
热议问题