db.collection.createIndex({name:1},{unique:true})
name:1
这个 1 应该如何理解?
1
checgg OP 已解决,没好好看文档。打扰了各位。
The value of the field in the index specification describes the kind of index for that field. For example, a value of 1 specifies an index that orders items in ascending order. A value of -1 specifies an index that orders items in descending order. For additional index types, see index types. |