Why this mongoose unique index is not working?

I have this basic entity in mongoose

const mongoose = require("mongoose");

const ParticipantSchema = mongoose.Schema({
    createdBy: {
        type: mongoose.Schema.Types.ObjectId,
        ref: "User",
        required: true
    },
    survey: {
        type: mongoose.Schema.Types.ObjectId,
        ref: "Survey",
        required: true
    },
    email: {
        type: String,
        required: false
    },
    firstName: {
        type: String,
        required: false
    },
    lastName: {
        type: String,
        required: false
    }
});

ParticipantSchema.index({ email: 1, survey: 1 }, { unique: true });

module.exports.Participant = mongoose.models.Participant || mongoose.model("Participant", ParticipantSchema);

as you can see it refers to 2 other entities. The problem I have is with the unique index: when I add 2 records with the same email and survey mongo does not complain and it creates 2 identical records. Am I doing anything wrong?