【发布时间】:2014-04-27 08:30:56
【问题描述】:
我需要将所有看到的值 0 更新为 1 使用 mongo 和 php 作为数组
enter code herearray (
'_id' => new MongoId("5357c023dd34bcc9298b456e"),
'_type' =>
array (
'0' => 'Altibbi_Mongo_MemberNotification',
),
'member_id' => '53068',
'notification_count' => new MongoInt32(30),
'notifications' =>
array (
'0' =>
array (
'actor_id' => '0',
'notification_type' => 'badge_top',
'date_added' => '2014-04-23 16:29:07',
'seen' => '0',
),
'1' =>
array (
'actor_id' => '0',
'notification_type' => 'badge_country',
'date_added' => '2014-04-24 08:32:55',
'seen' => '1',
)
),
)
我需要任何帮助来解决我使用 $ 它只更新单个第一个值的问题 我使用$each,它根本不起作用
【问题讨论】:
-
哪个问题?你为什么一开始就期望它起作用?您可以在此处参考您尝试使用的功能的手册吗?
-
$this->update(array('member_id'=>"53068" , "notifications.seen"=> "0"), array('$set' => array('notification_count' =>0 ,'notifications.$.seen' => "1"));
标签: php mongodb mongodb-php