是否有可能在newPDF.InsertPages newPDF.GetNumPages-1, PDDoc, i, 4, 0
中的模型之间列出relations
并删除或编辑它们?
更新架构: 公司:
Mongodb
产物:
{
"company": "string",
"name": "string",
"tel": "string",
"id": "string"
}
更新2:
{
"name": "string",
"qty": 0,
"exp": "string",
"id": "string"
}
答案 0 :(得分:1)
我仍然不能完全确定你要完成的任务。但是我建议您如何设计Schemata并添加foreign keys
如果我是你,我会像这样设计我的公司集合:
{
"_id" : ObjectId("5a291fd838f4fb1fc057bbbc"), // _id is automatically generated if you don't provide any
"name" : "ABC",
"tel" : "1234567"
}
{
"_id" : ObjectId("5a29208838f4fb1fc057bbbf"),
"name" : "DEF",
"tel" : "5556667"
}
这就是我设计产品集合的方式:
{
"_id" : ObjectId("5a29211838f4fb1fc057bbc4"),
"name" : "ProductA",
"qty" : NumberInt(1),
"exp" : "exp1",
"companyIds" : [
ObjectId("5a291fd838f4fb1fc057bbbc"), // the foreign keys of the each company
ObjectId("5a29208838f4fb1fc057bbbf")
]
}
这样可以更轻松地删除和更新您的馆藏。