我需要更新DBRef数组字段,而只需要更改$ ref字段值。
现有结构:
{
"_id":ObjectId("5ccfe299902bb32f5a194ed7"),
"email":"sheen.johndoe@gmail.com",
"bookletSignUps":[
DBRef("booklet",
ObjectId("5ccfe2a9902bb32f5a194ed8"))
]
}
推荐小册子SignUps文档:
{
"_id" : ObjectId("5ccfe2a9902bb32f5a194ed8"),
"email" : "example@gmail.com"
}
试图通过更新DBRef数组字段中的$ ref获得的结构:
{
"_id":ObjectId("5ccfe299902bb32f5a194ed7"),
"email":"sheen.johndoe@gmail.com",
"bookletSignUps":[
DBRef("bookletSignUps",
ObjectId("5ccfe2a9902bb32f5a194ed8"))
]
}