I have a collection like this in this collection I need to pull or remove the details from array where login date = 2015-12-23.Rest of the array should be same
Array
(
[_id] => 1
[user_id] => 2
[work_details] => Array
(
[0] => Array
(
[login_date] => 2015-12-23
[work_history] => Array
(
[0] => Array
(
[details] => gsdgsdgd
[datetime] => 2015-12-23 12:54:12
)
)
)
[1] => Array
(
[login_date] => 2015-12-24
[work_history] => Array
(
[0] => Array
(
[details] => ffgdf dfgdfh
[datetime] => 2015-12-24 12:54:12
)
)
)
)
)
I have tried like this
$this->mongo_db->where('login_date', "2015-12-23")->unset_field('login_date.$')->update('masterCollection');
$this->mongo_db->pull('login_date', NULL)->update('masterCollection');
but its not working
After removing the record I need the array like this
Array
(
[_id] => 1
[user_id] => 2
[work_details] => Array
(
[0] => Array
(
[login_date] => 2015-12-24
[work_history] => Array
(
[0] => Array
(
[details] => ffgdf dfgdfh
[datetime] => 2015-12-24 12:54:12
)
)
)
)
)
Is there any solution for this.
Thank you