What is the syntax for creating a new unique index on a field using the c# driver?

Hello @Andrew_Stanton, try this one.

This is by running the Database Command for createIndexes. The following creates a unique index on the title field of the books collection.

var cmdStr = "{ createIndexes: 'books', indexes: [ { key: { title: 1 }, name: 'title-uniq-1', unique: true } ] }";
var cmd = BsonDocument.Parse(cmdStr);
var result = mongoClient.GetDatabase("test").RunCommand<BsonDocument>(cmd);
Console.WriteLine(result);