Dmitri Pisarev
07/27/2022, 12:47 PMUser {
groups: [{
groupId: 'group1-id',
membershipType: 'Member'
}, {
groupId: 'group2-id',
membershipType: 'Admin'
}]
}
I want User.groups.groupId
to be a relation. It’s currently not possible to set relationships on composite types.
Is there any workaround around this? Any better way to attach some attribute to a relationship?Austin
08/02/2022, 8:30 PMDmitri Pisarev
08/20/2022, 7:01 AMtype GroupMembership {
communityId String @db.ObjectId
role GroupUserRole
}
model User {
groups GroupMembership[]
}
What do you mean by full model? If you mean a separate collection, then no, we’d rather not do that, as it’s not really a Mongo way for modelling such things.Austin
08/22/2022, 7:22 PMVladi Stevanovic