如何乘以用户数据中的数量?

How can I multiply the amount in the data of user?

我想做一个俄罗斯轮盘,然后如果我做了 rr all 那么当他们赢了时他们的所有余额都会成倍增加,但是做 data.wallet * 2 是行不通的。我该怎么做?

economy.findOneAndUpdate({
    guildID: message.guild.id,
    userID: message.author.id
}, {$inc: {wallet: amount }}, async(err, data) => {
    if(data) {
        data.wallet * 2
        data.save()
    }
})

您可以使用{$mul}来乘以当前余额。

economy.findOneAndUpdate({
    guildID: message.guild.id,
    userID: message.author.id
}, {$mul: {wallet: 2}}, async(err, data) => { //This is how you can multiply the balance wallet: 2 then save it as
    if(data) {
    data.wallet * 2 //like this
    data.save()
  }
})