mongoose get collections that not includes certain item in sub document

Viewed 23

this is my schema

const CourseSchema = new mongoose.Schema({
    title: {
    },
    cost: {
    },
    students: [
        {
            _id: ObjectId,
            fullName: String,
            email: String
        }
    ]
});

I have student John Doe with objectId: "something" , in mongoose how can I get courses that not include john doe? in simple words show him courses that he doesn't buy.

1 Answers
Related