How to resolve populate with different field instead of _id in MoleculerJS

69 views Asked by At

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

There are 1 answers

0
Ivan Zhuravlev On BEST ANSWER

Use idField in your service:

{
  settings: {
    idField: "uId"
  }
}

Documentation reference