I'm using the following Mongoose model:
var Test = db.model('Test', db.Schema({
one: { type: String, required: true },
two: { type: String, required: true }
},
{ strict: false })
);
It has two required fields,one
and two
, and strict:false
because there can be other fields with undetermined names.
I would like the combination of one
and two
to be unique. That means there could be multiple documents with the same one
or the same two
, but none of them should have the same one
and two
combination.
Can this be achieved with Mongoose?