unique mongoose code example
Example 1: mongoose unique field
var SimSchema = new Schema({
msisdn : { type : String , unique : true, required : true, dropDups: true },
imsi : { type : String , unique : true, required : true, dropDups: true },
status : { type : Boolean, default: true},
signal : { type : Number },
probe_name : { type: String , required : true }
});
Example 2: js array of strings mongoose
var personSchema = new mongoose.Schema({
tags: [{
type: String
}]