脚本宝典收集整理的这篇文章主要介绍了mongodb exception: $concat only supports strings, not NumberInt32解决办法,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
今天在用Mongodb操作aggregation的时候出现这个问题,我是想格式化日期,例如”2013-10-17 04:41:37 UTC”变成”10月17日”,
原来$concat只能操作字符串,不支持数字类型,解决办法是用$substr
'fdate' => { '$concat' => [ {$substr=>['$date', 5, 2]}, '月', {$substr=>['$date', 8, 2]}, '日'] }
以上是脚本宝典为你收集整理的mongodb exception: $concat only supports strings, not NumberInt32解决办法全部内容,希望文章能够帮你解决mongodb exception: $concat only supports strings, not NumberInt32解决办法所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。