我需要从多个mongodb对象数组数据中获取不同的值。
{
"_id": ObjectId("5ae2dca33319b21f1289ad38"),
"NumEntries": NumberLong(3),
"Data": [
{
"Timestamp": "Apr 27 13:42 2018",
"Client": "Manoj"
},
{
"Timestamp": "Apr 27 13:42 2018",
"Client": "Rajesh"
},
{
"Timestamp": "Apr 27 13:43 2018",
"Client": "Manoj"
}
]
}
{
"_id": ObjectId("5ae2dc983319b26f4889ac8a"),
"NumEntries": NumberLong(1),
"Data": [
{
"Timestamp": "Apr 27 13:42 2018",
"Client": "Vikas"
}
]
}
所以,我需要找到不同的客户名称,如Manoj,Rajesh&维卡斯 我正在使用Codeigniter MongoDB libarary。到目前为止尝试过:
$uniquemacids = $this->mongo_db->distinct('demologs', 'Data.Client');
它给我布尔假/ null作为响应