I’m creating an app for which users can register and join different events (by paying specified amount). An event can be subscribed in three different ways i.e
- Solo (1 Person)
- Duo (2 Persons)
- Group (More than 2 persons)
Let’s name this as SubscriptionCategory. There would be different set of tasks in each SubscriptionCategory.
Now to complete event users will have to complete the given tasks. Each task will have some scores which user can gain after completion of each task. At the finishing of event a user or a group which will have maximum scores will be declared as winner and would be eligible for the prize money.
Schema I have been thinking is below:
— DATEBASE NAME ( Social-Events )
— — User ( collection )
{
name: {
type: String,
required: true,
trim: true,
},
email: {
type: String,
required: true,
index: { unique: true },
lowercase: true,
trim: true,
},
events: [{ type: Schema.Types.ObjectId, ref: 'Event' }],
formattedAddress: String,
password: {
type: String,
required: true,
trim: true,
minlength: [6, 'Password must be 6 characters long'],
},
}
— — Event ( collection )
{
name: {
type: String,
required: true,
trim: true,
},
startsAt: {
type: Date,
required: true,
},
endsAt: {
type: Date,
required: true,
},
prizeMoney: {
type: Number,
required: true,
},
subscriptionCategory: [
{
name: String,
price: Number,
tasks: [
{
name: String,
description: String,
scores: Number,
},
],
}
]
subscribers: [{ type: Schema.Types.ObjectId, ref: 'User' }],
},
Now the issues I’m facing are:
- I’m not able to store how a user subscribed to the event?
- The Tasks user have completed in an event
- Whether the task user completed have been approved as done by the admin.
Should I suppose to make kind of bridge collection similar to Bridge table we use to make in relational database?
I’m sorry I’m new to NO-SQL and I can’t figure that on my own. I’ve followed basic guideline to model a database from attached link.