0
{
"_id": "58be5a4a031372098578b1d6",
"name": "A",
"email": "[email protected]",
"username": "A.a",
"password": "$2a$05$GAF1hP91EowKUTKr14ASL.MRd2lOjotfOgVlEghwnqctNcIe5seNW",
"latitude": 12,
"longitude": 72,
"profilePic": "images/A.png",
"__v": 9,
"isBuddyEnabled": true,
"friendRequests": [
{
"friendId": "58be7aa0c204cb134068975d",
"isAccepted": true
},
{
"friendId": "58bf8cb4c26d5811b188a600",
"isAccepted": false
}
],
"friends": [
"58be7aa0c204cb134068975d"
],
"networkContacts": [
{
"profession": "doctor"
}
],
"interests": [
"sports",
"music"
]
}
我有一個用戶上面的JSON,現在我需要這樣的json的數組的所有信息,其friendRequest isAccepted是假的,這意味着這些請求正在等待對他來說, 爲如:當我打API /請求/ 58be5a4a031372098578b1d6 =>我得ID的信息58bf8cb4c26d5811b188a600REST API
到現在我能中檢索其請求,通過下面的查詢
app.post('/api/users/requests/:id'function(req,res){User.find({"_id":req.params.id})
.find({"friendRequests.isAccepted":false},function(err,callback){}})
在數組中的子文檔這個我已經實現了,但我需要得到friendId isAccepted的,其整個JSON是假 –
也爲上面的代碼拋出「無法讀取的不確定 財產‘過濾器’」 –