public void SetMongoDbIndex(string mongoDbIndex) { JObject joIndex = JObject.Parse(mongoDbIndex); string collName = (string)joIndex["collName"]; JArray indexs = (JArray)joIndex["indexs"]; for (var i = 0; i < indexs.Count; i++) { string indexName = (string)indexs[i]["indexName"]; string indexDefinition = indexs[i]["indexDefinition"].ToString(); bool isUnique = false; if (indexs[i]["isUnique"] != null) { isUnique = (bool)indexs[i]["isUnique"]; } MongoDBHelper.CreateIndex(this.Conn, this.DataBase, collName, indexDefinition, indexName, isUnique); } }