如何拉出有键的内部数组address1
"_id": 2,
"info": {
"address1": {
"city": {
"0": "Indore"
},
"state": {
"0": "MP"
}
},
"address2": {
"city": {
"0": "Mhow"
},
"state": {
"0": "MP"
}
}
}
删除数据后应该是:
"_id": 2,
"info": {
"address1": {
"city": {
"0": "Indore"
},
"state": {
"0": "MP"
}
}
}
我用过这个db.info.update({"_id":2},{'$pull':{"info":{"address1":{'$exists':true}}}})
但它给出了错误Cannot apply $pull/$pullAll modifier to non-array