2
letterSchema.virtual('vObj_department', {
    ref: 'Department',
    localField: 'LOC_ID LET_DEP_ID',
    foreignField: 'LOC_ID DEP_ID',
    justOne: true,
})

Both the Letter and the Department schemas have a LOC_ID variable. I wish to join these two schemas in a populate only if both their LOC_ID matches, and LET_DEP_ID == DEP_ID. Is this possible? If not, any work-arounds?

0 Answers0