0
내 mongodb에 컬렉션 이름 dbapp가 있습니다. widgets.I 당신은 운영자 $ 풀을 사용할 수 있습니다 that.Apprciate 당신의 help.thanks컬렉션 내의 배열 객체 삭제 mongo db
db.dbapp.insert(
{
"tenantid": 16,
"id": 0,
"default": true,
"widgets": [
{
"_id": new ObjectId(),
"position": 1,
"type": 1,
"class": "green",
"metricid": 5
},
{
"_id": new ObjectId(),
"position": 2,
"type": 1,
"class": "blue",
"metricid": 6
},
{
"_id": new ObjectId(),
"position": 3,
"type": 2,
"class": "normal",
"metricid": 1
},
{
"_id": new ObjectId(),
"position": 4,
"type": 2,
"class": "normal",
"metricid": 2
},
{
"_id": new ObjectId(),
"position": 5,
"type": 2,
"class": "normal",
"metricid": 3
}
],
"settings": {
"appid": 0,
"appname": "default"
}
});
는 지금까지 시도 무엇 최초의 위젯을 제거 할 것인가? 위치 연산자 $와 $ pull 메서드를보십시오. 참조 - http://stackoverflow.com/documentation/mongodb/1683/crud-operation/22368/update-of-embedded-documents#t=201705171111210941696 –