Following is the content in mongodb
like this:
{
"_id": 74924,
"bangs": {
"436": {
"join_time": 1345624851,
"status": 1,
"scores": 0
},
"446": {
"join_time": 1355727257,
"status": 1,
"scores": 0
}
},
"_id": 74926,
"bangs": {
"436": {
"join_time": 1345624851,
"status": 1,
"scores": 0
},
"446": {
"join_time": 1355727257,
"status": 1,
"scores": 0
}
}
}
I want to delete :
"436": {
"join_time": 1345624851,
"status": 1,
"scores": 0
},
where _id=74924
The result will be:
{
"_id": 74924,
"bangs": {
"446": {
"join_time": 1355727257,
"status": 1,
"scores": 0
}
},
"_id": 74926,
"bangs": {
"436": {
"join_time": 1345624851,
"status": 1,
"scores": 0
},
"446": {
"join_time": 1355727257,
"status": 1,
"scores": 0
}
}
}
I wrote the code like this:
$mongo->users->users->update(array('_id'=>74924), array('$pull'=>array('bangs'=>436)));
But the record didn't remove
How can i write the code?
Thanks in advance!