MongoCollection.createIndex

string createIndex(T)(T keys, IndexOptions indexOptions = IndexOptions.init, CreateIndexOptions options = CreateIndexOptions.init) if (!is(Unqual!T == IndexModel)) @safe

Convenience method for creating a single index. Calls createIndexes

Supports any kind of document for template parameter T or a IndexModel.

Parameters

keysa IndexModel or type with integer or string fields indicating index direction or index type.
string createIndex(const IndexModel keys, CreateIndexOptions options = CreateIndexOptions.init) @safe

ditto