{ _id: 5150a1199fac0e6910000002, name: 'some name, items: [{ id: 23, name: 'item name 23' },{ id: 24, name: 'item name 24' }] } 删除代码 db.mycollection.update( {'_id': ObjectId("5150a1199fac0e6910000002")}, { $pull: { "items" : { id: 23 } } } );
{ _id: 5150a1199fac0e6910000002, name: 'some name, items: [{ id: 23, name: 'item name 23' },{ id: 24, name: 'item name 24' }] } 删除代码 db.mycollection.update( {'_id': ObjectId("5150a1199fac0e6910000002")}, { $pull: { "items" : { id: 23 } } } );