Mongodb using addtoSet to ensure there are no duplicates Mongodb using addtoSet to ensure there are no duplicates mongoose mongoose

Mongodb using addtoSet to ensure there are no duplicates


After reading this, it got me thinking;

Stop Mongoose from creating _id property for sub-document array items

Found a fix;

Model now looks like this;

 var subSchema = new mongoose.Schema({email: {type: String, trim: true, _id: false}},{ _id : false })invite_list: [subSchema], 

Works as expected...

J