MongoCollection.dropIndex

Drops a single index from the collection by the index name.

  1. void dropIndex(string name, DropIndexOptions options)
    struct MongoCollection
    @safe
    void
    dropIndex
    (
    string name
    ,
    DropIndexOptions options = DropIndexOptions.init
    )
  2. void dropIndex(T keys, IndexOptions indexOptions, DropIndexOptions options)
  3. void dropIndex(IndexModel keys, DropIndexOptions options)

Throws

Exception if it is attempted to pass in *. Use dropIndexes() to remove all indexes instead.

Examples

import vibe.db.mongo.mongo;

void test()
{
	auto coll = connectMongoDB("127.0.0.1").getCollection("test");
	auto primarykey = IndexModel()
			.add("name", 1)
			.add("primarykey", -1);
	coll.dropIndex(primarykey);
}

Meta