I’m trying to find documentation, to no avail, on how to create multi-field indexes in Mongoosejs. In particular I have two fields that need to be indexed and unique. What is an example mongoose schema that indexes two fields together?
I’m trying to find documentation, to no avail, on how to create multi-field indexes
Share
You call the
indexmethod on yourSchemaobject to do that as shown here. For your case it would be something like: