I'm very new to the NoSQL way of doing things so please excuse me if I'm just thinking about this completely wrong (I feel like I am).
My application has Users and Organizations, and the Users must have and belong to those Organizations with a role of member or owner.
Currently in my schema for my Users I have:
orgs: [{ type: Schema.Types.ObjectId, ref: 'Org' }]
and in my schema for my Organizations I have:
members: [{ type: Schema.Types.ObjectId, ref: 'User' }]
but I would also like to attach a role of member or owner to this.
Is this something I should put in the actual reference somehow like:
members: [{ type: Schema.Types.ObjectId, ref: 'User', role: String }]
or should the role be elsewhere in the schema? What is the proper way to handle this or is there a different way to schematize this that is more appropriate?
And once I have the schema set up for this properly, it would be helpful to have an example of how to create a few users/orgs with this roled ref.