在我的查询中, concat 关键字不起作用,它返回null
.
这是查询:-
db.leads.aggregate([
{$project:{
_id:0,
status:1,
stage:1,
"todo.title":1,
created:{
day:{$substr:["$createdOn",8,2]},
month:{$substr:["$createdOn",5,2]},
year:{$substr:["$createdOn",0,4]}
},
myDate:{$concat:["$created.day","-","$created.month","-","$created.day"]}
//----above $concat is not working-----//
//--i want that `myDate` should be "12-09-2016"----//
}
}
])
这是查询输出:-
{
"stage" : "Prospect",
"todo" : [],
"status" : "OPEN",
"created" : {
"day" : "12",
"month" : "09",
"year" : "2016"
},
"myDate" : null
//--here i want that `myDate` should be "12-09-2016"----//
}
createdOn字段数据存储在 mongodb 作为日期类型,即