title: MongoDB createIndexes exception on MongoDB.Driver.GridFS.Delete
body: <p>I am using <em>C# MongoDB.Driver, Version=1.10.1.73</em>.</p>
  
  <p>Note I am aware of <a href="https://stackoverflow.com/questions/6218966/creating-mongodb-unique-key-with-c-sharp">this question</a>, not my issue whatsoever.</p>
  
  <p>Error message:</p>
  
  <blockquote>
    <p>MongoDB.Driver.MongoWriteConcernException: Command 'createIndexes'
    failed: exception: Index with name: filename_1_uploadDate_1 already
    exists with different options (response: {
    "createdCollectionAutomatically" : false, "numIndexesBefore" : 4,
    "errmsg" : "exception: Index with name: filename_1_uploadDate_1
    already exists with different options", "code" : 85, "ok" : 0.0 })</p>
  </blockquote>
  
  <pre><code>MongoDatabase _database;
  var query = MongoDB.Driver.Builders.Query.And(
      MongoDB.Driver.Builders.Query.EQ(ColumnFilename, filePath),
      MongoDB.Driver.Builders.Query.EQ(ColumnWidth, width),
      MongoDB.Driver.Builders.Query.EQ(ColumnHeight, height));
  
  var mongoFileInfo = _database.GridFS.FindOne(query);
  if (mongoFileInfo != null) { 
      var mongoStream = mongoFileInfo.OpenRead();
      if (/*some condition*/) {
          mongoStream.Close();
          mongoStream.Dispose();
          mongoFileInfo.Delete(); // exception here
      }
  </code></pre>
  
  <p>Full stack trace:</p>
  
  <blockquote>
    <p>MongoDB.Driver.MongoCollection.CreateIndex(IMongoIndexKeys keys,
    IMongoIndexOptions options)<br>
    MongoDB.Driver.MongoCollection.CreateIndex(IMongoIndexKeys keys)<br>
    MongoDB.Driver.MongoCollection.CreateIndex(String[] keyNames)<br>
    MongoDB.Driver.GridFS.MongoGridFS.EnsureIndexes(Int32 maxFiles)<br>
    MongoDB.Driver.GridFS.MongoGridFS.EnsureIndexes()<br>
    MongoDB.Driver.GridFS.MongoGridFSFileInfo.Delete()</p>
  </blockquote>