I have a collection in MongoDB called 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"
}
]
}
I want to add messages in proposal attributes whose sender_id=5 like below;
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"
}
]
}
My document is,
$document = array(
"message_sender" =>"Can we meet",
"date" => "2013-08-06"
);
I am really having a hard time doing a this thing. which is add a messages to the proposal array. Any help out there with php code?