Creates an index on the db and collection (will not create if already exists)
-
fieldOrSpec
(String|Array|Object): Defines the index. -
[
options
] (object) -
[
callback
] (function)
A promise
users.createIndex('name.first')
users.createIndex('name last')
users.createIndex(['nombre', 'apellido'])
users.createIndex({ up: 1, down: -1 })
users.createIndex({ woot: 1 }, { unique: true })