英文:
How to resolve populate with different field instead of _id in MoleculerJS
问题
我正在创建一个用于从MongoDB查询Tasks集合的服务。它具有一个名为uId的自定义id字段,以及一个任务模型中的名为subtask的字段,该字段存储其他任务的uId。我希望填充subtask字段,任务模型如下 task model
我期望用uId填充subtask字段。
英文:
I am creating a service to query Tasks collection from the MongoDB. It have a custom id field called uId, and a task store other uId of other taks in its field named subtask. I want to populate the field subtask, the task model is this task model
I expect to populate the field subtask with uId
答案1
得分: 0
在你的服务中使用idField:
{
settings: {
idField: "uId"
}
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论