字段“attributeMetaDataList”具有类似的参考
, "path" : "Health & Personal Care > Health > Health Aids > Bathroom Aids & Safety > Bathtub Rails", "attributeMetaDataList" : [ {
"$ref" : "AttributeMetadata",
"$id" : ObjectId("50726bd4e4b0adf08145e4f1")
}, {
"$ref" : "AttributeMetadata",
"$id" : ObjectId("50726bd4e4b0adf08145e4f2")
}, {
"$ref" : "AttributeMetadata",
"$id" : ObjectId("50726bd4e4b0adf08145e4f3")
}, {
"$ref" : "AttributeMetadata",
"$id" : ObjectId("50726bd4e4b0adf08145e4f4")
}, {
"$ref" : "AttributeMetadata",
"$id" : ObjectId("50726bd4e4b0adf08145e4f5")
} ]
我想通过循环删除这个引用。
我用过,
db.Category.find({"path": /Health & Personal Care/}).forEach(function(x){
x.attributeMetaDataList=$unset
}
)
这对我不起作用。有什么帮助吗?