我正在尝试使用mongoengine从listField(embeddedDcoument)查询所有详细信息。
def get_image_details(self):
image_detail = job_process.objects(__raw__={'image_details'[0][0]})
image_detail = image_detail.to_json()
return image_detail
这是数据库条目
"_id": ObjectId("5b86b7d363fea4bc4ea86150"),
"_cls": "job_process",
"title": "TITLE",
"job_id": "9faf4ff8-88b2-4051-bb98-763864ed9206",
"job_status": "new_job",
"date_time_stamp": new Date(1535555539094),
"author": "name of author",
"short_caption": "short caption",
"image_details": [
[
{
"position": 0,
"seconds": 46,
"src_url": "https://tmp/1.jpg",
"image_fname": "1.jpg",
"local_url": "/image_folder/9faf4ff8-88b2-4051-bb98-763864ed9206/1.jpg"
}
],
[
{
"position": 1,
"seconds": 3,
"src_url": "https://hellos/2.jpg",
"image_fname": "2.jpg",
"local_url": "/image_folder/9faf4ff8-88b2-4051-bb98-763864ed9206/2.jpg"
}
],
[
{
"position": 2,
"seconds": 6,
"src_url": "https://slides/3.jpg",
"image_fname": "3.jpg",
"local_url": "/image_folder/9faf4ff8-88b2-4051-bb98-763864ed9206/3.jpg"
}
],
我想做的就是检索所有“ image_details”