Relationships and References in Mongo DB

I am currently working on a project that has many threads that users can create. The user has different permissions for streams, which can be specified by users with administrator rights. A user must be added to a stream before they can access it.

When a user is added to a stream, they are granted read, write, or admin permission. Users can also be part of groups. These groups can then be added to the stream, in which case all users in the group will be added along with the permission specified for the group.

thread: {id: xxxxx, users:[{id:user01, permission: write, discovery: non}, {id:user02, permission: read, discovery: GroupA}]}

      

Thus, a user can be added with individual permission, or can be added with permission granted to the group they belong to. Discovery will determine if the user was added individually or as a group.

I'm wondering if this would be the best way to set up Mongo for such a permission system, and also how do I actually define this schema using Mongoose? I think it would be fastest to include all these aspects in every thread.

+3
reference mongodb nosql schema relationships


source to share


No one has answered this question yet

See similar questions:

1
How to deal with relationships when using mongodb

or similar:

3076
What are the differences between a pointer variable and a reference variable in C ++?
2427
How do I pass a variable by reference?
682
How to list all collections in mongo shell?
416
MongoDB relationships: embedding or linking?
192
How do you request this in Mongo? (is not null)
133
Is Mongo ObjectId duplicate being created in two different collections?
8
Mongos Authentication
2
Mongoose Mongo 2dsphere geoWithin
0
Various custom schemas in mongo db with mongoose js
0
Relationships in MongoDB



All Articles
Loading...
X
Show
Funny
Dev
Pics