mongodb exception: $concat only supports strings, not NumberInt32解决办法
今天在用mongodb操作aggregation的时候出现这个问题,我是想格式化日期,例如”2013-10-1704:41:37UTC”变成”10月17日”,
'fdate'=>{'$concat'=>['$date.month','月','$date.day','日']}出现exception:$concatonlysupportsstrings,notNumberInt32
原来$concat只能操作字符串,不支持数字类型,解决办法是用$substr
$date形如'2013-10-1311:17:18UTC'
'fdate'=>{'$concat'=>[{$substr=>['$date',5,2]},'月',{$substr=>['$date',8,2]},'日']}
热门推荐
3 祝福语简短的微信
10 幼儿祝福语大全简短贺卡
11 感谢教官文案祝福语简短
12 鼠年同事祝福语简短创意
13 元旦祝福语 简短独特群发
14 妈咪跟我生日祝福语简短
15 给儿子新婚祝福语简短
16 伴娘祝福语长文案简短
17 恭喜高考完祝福语简短
18 生日祝福语送老公简短