{
"_id": "590ad2c78eb79d16bde4a15d",
"user": "yejia@qq.com",
"password": "111111",
"__v": 0,
"lists": [
{
"_id": "590ad2d78eb79d16bde4a15e",
"update_at": "2017-05-04T07:05:52.174Z",
"create_at": "2017-05-04T07:05:52.174Z",
"title": "测试1",
"isChecked": [
false
],
"details": [
"未完"
]
},
{
"_id": "590ad3398eb79d16bde4a15f",
"update_at": "2017-05-04T07:07:28.784Z",
"create_at": "2017-05-04T07:07:28.784Z",
"title": "测试2",
"isChecked": [
false,
false
],
"details": [
"1232",
"333"
]
}
]
}
Like this example, if I want to find a subdocument based on its id: "_id": "590ad2d78eb79d16bde4a15e", what should I do? To explain, I know how to query directly by id. What I don’t understand is how to query subdocuments using the id of the subdocument.
仅有的幸福2017-05-17 10:05:14
You can view the API documentation of mongoose, the chapter about sub_doc operation, http://mongoosejs.com/docs/subdocs.html