嗨以下是mongodb中的文档,现在我要删除数据 Kumar []在给定的文档中,我使用了(更新pop)并删除了函数。一个是删除内部数据,另一个是删除整个文档,删除文档中所需数据
的任何帮助 {
"_id" : ObjectId("537d98c2a8357030c4f46cc0"),
"name" : "karan",
"address" : "hyd",
"hobbies" : [
"listeningmusic",
"chess"
],
"friends" : [
{
"satish" : "school"
},
{
"naresh" : "college"
},
{
"dileep" : "school"
},
{
"pavan" : "neighbour"
},
{
"kumar" : "office"
}
],
"kumar" : []
}
我尝试了以下查询
db.userdata.update({kumar:"office"},{$pull:{kumar:"office"}})
db.userdata.remove({kumar:"office"},1)