现在我有一个“答案”数组,我想删除这个数组的第一个,但是这个数组的索引项是 1 但不是 0。我不知道 mongodb 是否支持删除项数组和更新索引数组?我的代码:
删除前:
数组(
'_id' => new MongoId("52818f9ad069feed198b4567"),
'answers' => 数组('0' => array ( 'by' => new MongoId("52818ec2d069fe90058b4567"), 'content' => '<p>Ok, testing<br /> </p> ', 'date' => new MongoInt32(1384222656), ), '1' => array ( 'by' => new MongoId("528192acd21b6310188b4567"), 'content' => 'test', 'date' => new MongoInt32(1384224360), ),
),
删除答案数组的第一项后
数组(
'_id' => new MongoId("52818f9ad069feed198b4567"),
'answers' => 数组('1' => array ( 'by' => new MongoId("528192acd21b6310188b4567"), 'content' => 'test', 'date' => new MongoInt32(1384224360), ),
),
我的结果需要
数组(
'_id' => new MongoId("52818f9ad069feed198b4567"),
'answers' => 数组('0' => array ( 'by' => new MongoId("528192acd21b6310188b4567"), 'content' => 'test', 'date' => new MongoInt32(1384224360), ),
),
我的英语很差,但请帮助我!