`
wang_peng1
  • 浏览: 3904968 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

统计条件查询

 
阅读更多

if amount < 0, then 0 - amount  else 

{ $project: {
  amount: {
    $cond: [
      { $lt: ['$amount', 0] },
      { $subtract: [0, '$amount'] }, 
      '$amount'
    ]
}}}

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics