R
R
Rag'n' Code Man2021-08-25 17:04:28
MongoDB
Rag'n' Code Man, 2021-08-25 17:04:28

What is the best way to implement student and group scheduling in MongoDB?

We are developing a CRM system for an online school and it became necessary to redesign / make sure that the schedule scheme is correct.

There are two main collections in the database - students and groups. When we create a schedule for a group, a copy of it is added to all its students (so that you can pay for the days for each separately).

The schedule looks like this:

export class Schedule {
    @prop({ type: Boolean, required: false })
    paid: boolean;

    @prop({ type: String, required: false })
    tutor: string;

    @prop({ type: String })
    date: string;

    @prop({ type: () => [String] })
    duration: string[];

    @prop({ type: Number, required: false, default: 2 })
    status: number;

    @prop({ type: String })
    message: string;

    @prop({ type: String, required: false })
    start: string;

    @prop({ type: String, required: false })
    finish: string;
}

And as a result, the group and the students get a huge array of objects of this type. Since I was extremely inexperienced when I designed all this, I highly doubt that I did everything right. Maybe. Should it be put in a separate collection? But while the students individually change the objects of this array - for example, the status from paid to true.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question