标签: json mongodb
我在MongoDB中有一个看起来像{"0":"2","1":"1","2":"2","3":"1"}"的JSON对象,我想将它们转换成看起来像"2121"的字符串。反正有做吗?
{"0":"2","1":"1","2":"2","3":"1"}"
"2121"
答案 0 :(得分:0)
使用可以实现的concat函数
db.getCollection('test').aggregate([ { $project:{number:{$concat:[ "$0", "$1", "$2","$3" ]}} } ])
希望有所帮助