以下是MongoDB官方文档中关于唯一索引的解释
Unique Indexes
MongoDB supports unique indexes, which guarantee that no documents are inserted whose values for the indexed keys match those of an existing document. To create an index that guarantees that no two documents have the same values for both firstname and lastname you would do: