我在 MongoDB 中有一个名为 job 的集合
Job{
_id : ‘12344’,
cust_id: 'cust1',
title: 'Create Website',
description: 'We require it in 2 weeks only',
location: 'japan',
images:{
'image1',
'image2',
'image3'
},
video:{
'video1',
'video2'
},
budget:'15000',
duration:'2 weeks',
Proposals:[{
"sender_id" => "5",
"description" =>"I can do your task before 2 week",
"date" => "2013-08-05"
},
{
"sender_id" => "6",
"description" =>"I can do your task in 2 week, with best quality",
"date" => "2013-08-05"
}
]
}
我想在 sender_id=5 的提案属性中添加消息,如下所示;
Job{
_id : ‘12344’,
cust_id: 'cust1',
title: 'Create Website',
description: 'We require it in 2 weeks only',
location: 'japan',
images:{
'image1',
'image2',
'image3'
},
video:{
'video1',
'video2'
},
budget:'15000',
duration:'2 weeks',
Proposals:[{
"sender_id" => "5",
"description" =>"I can do your task before 2 week",
"date" => "2013-08-05"
“messages”:[{
"message_sender" :"Can we meet",
"date" : "2013-08-06"
}
]
},
{
"sender_id" => "6",
"description" =>"I can do your task in 2 week, with best quality",
"date" => "2013-08-05"
}
]
}
我的文件是,
$document = array(
"message_sender" =>"Can we meet",
"date" => "2013-08-06"
);
我真的很难做这件事。这是向提案数组添加消息。php代码有什么帮助吗?