我有文档,在这里我需要填充所有对象并添加额外的字段
"last_message": "Hello"
以上一个
/ * 1 * /
{
"_id": "5b5067ce15c4e462fd43732a",
"users": [
"5b0d4c5ec47e6223a08af5fb",
"5b1625f762368179e1e4549b",
"5b0d3c00b426ea12ec0f6e3a"
],
"group_name": "Group 1",
"created_at": "2018-07-19T10:28:30.967Z",
"last_updated_at": "2018-07-19T10:28:30.967Z",
"__v": 0
},
/ * 2 * /
{
"_id": "5b5067e915c4e462fd43732c",
"users": [
"5b0d4c5ec47e6223a08af5fb",
"5b0d3c00b426ea12ec0f6e3a"
],
"created_at": "2018-07-19T10:28:57.084Z",
"last_updated_at": "2018-07-19T10:28:57.084Z",
"__v": 0
}
}
我在聚合函数中与$ addField一起使用,仅添加了它。填充功能不起作用。该如何处理。