Skip to content

Instantly share code, notes, and snippets.

@SZharkov
Created April 7, 2023 08:06
Show Gist options
  • Save SZharkov/5caad846db7bc91ba030061b80c855d9 to your computer and use it in GitHub Desktop.
Save SZharkov/5caad846db7bc91ba030061b80c855d9 to your computer and use it in GitHub Desktop.
Mongoose: make a combination of two fields unique
person.index({ firstName: 1, lastName: 1}, { unique: true });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment