我有以下数据
> db.user.find().pretty().limit(1);
{
"_id" : ObjectId("59a7ead6d122a2332e1eb164"),
"name" : "Jack",
"status" : "VERIFIED",
"attributes" : [
{
"value" : "vijay jha",
"name" : "patient",
"key1" : "",
"key2" : "",
"key3" : ""
},
{
"value" : "",
"name" : "notes",
"key1" : "",
"key2" : "",
"key3" : ""
},
{
"value" : "Thomas",
"name" : "surgeon",
"key1" : "",
"key2" : "",
"key3" : ""
}
]
}
我正在尝试编写查询以获取如下所示的输出,我正在尝试使用unwind
,但这会产生错误的结果
{
"_id":ObjectId("59a7ead6d122a2332e1eb164"),
"name":"Jack",
"status":"VERIFIED",
"patient":"vijay jha",
"notes":"",
"surgeon":"Thomas"
}