我有这样的文件
{
"_id": ObjectId("4ffa96436ccc195553000055"),
"on": {
"4e8614f66ccc19aa490006e3": {
"hid": ObjectId("4e8614f66ccc19aa490006e3"),
"mts": NumberInt(1352979215)
},
"4e8614f06ccc19d9340003e8": {
"hid": ObjectId("4e8614f06ccc19d9340003e8"),
"mts": NumberInt(1352979216)
},
"4e8614346ccc19aa490006df": {
"hid": ObjectId("4e8614346ccc19aa490006df"),
"mts": NumberInt(1352979218)
},
"505af2e66ccc19541d0005a9": {
"hid": ObjectId("505af2e66ccc19541d0005a9"),
"mts": NumberInt(1352979220)
},
"505af2d76ccc19f11300109a": {
"hid": ObjectId("505af2d76ccc19f11300109a"),
"mts": NumberInt(1352979221)
}
}
}
有时我需要从“on”字段中删除子字段。我这样做:
$this->collection->update(
array(
'_id' => new MongoId('4ffa96436ccc195553000055'),
"on.4e8614f66ccc19aa490006e3" => array('$exists' => true),
),
array(
'$unset' => array(
"on.4e8614f66ccc19aa490006e3" => 1
)
)
);
但是字段不要删除。我究竟做错了什么?
PS我在发送查询后检查了错误,我得到了这个错误 修饰符和非修饰符不能混合代码:10154