如何像 $dec 一样递减? [英] How to decrement like $dec?
本文介绍了如何像 $dec 一样递减?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 Meteor 排行榜示例中有这一行:
In the Meteor leaderboard example there is this line:
Players.update(Session.get("selected_player"), {$inc: {score: 5}});
如何优雅地减少同一个字段?遗憾的是,没有 $dec.
How can I gracefully decrement the same field? Sadly, there is no $dec.
推荐答案
增量 -1?
$inc: {score: -1}
这篇关于如何像 $dec 一样递减?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文