0
嵌套的文件,這是我蒙戈DOC:刪除從蒙戈陣列
{
"_id" : ObjectId("51f22f6784aefaa97d7e533e"),
"group_name" : "demo",
"privileges" : [
"User Group",
"Profile Images",
"Advertisement"
],
"users" : [
{
"full_name" : "aap",
"password" : "as",
"status" : "Active",
"user_name" : "as"
},
{
"full_name" : "b",
"user_name" : "b",
"password" : "b",
"status" : "Active"
},
{
"full_name" : "prashant",
"user_name" : "pt123",
"status" : "Active"
}
]
}
我想找到有「GROUP_NAME」的所有記錄:「演示」刪除有「USER_NAME」特定的記錄:「pt123」形式的用戶陣列。 我試過
db.users.update({"group_name":"demo"}, {$pull:{"users.user_name":"pt123"}})
但是沒有效果。我缺乏什麼? 請幫助我 java代碼是你
BasicDBObject del = new BasicDBObject("group_name", z);
del.put("users.user_name", x);
BasicDBObject delquery=new BasicDBObject("$match",del);
con.remove(delquery);