Hello everyone.
I have two collections, one is for the user data, with firstName, lastName, etc and theres a field called userRole:
userRole:{
type: mongoose.Schema.ObjectId,
ref: 'userRoles',
required: [true, 'Please Select a Role']
}
This field will be responsible to save the role id, it’s a join field.
The question is, how may I join the collection users with the collection usersRole, and also I would like to show all the fields for the user Collection but bring from the usersRole only the roleDescription, actually is a user level query, I’m trying to show the user info. inside a table and I need the user name, user address and the user Role.
I would like to thank everyone for the help.
Best Regards,
Ricardo Scarpim