Represents a BSON document that can be used where an IMongoIndexOptions is expected.
Inheritance: BsonDocument, IMongoIndexOptions
        /// <summary>
        /// 新建索引
        /// </summary>
        /// <param name="jsonData"></param>
        public void CreateIndex(string jsonData)
        {
            var model = JsonConvert.DeserializeObject<SaveIndexModel>(jsonData);
            var idxDoc = ToDoc(model.Keys);
            var idxOption = new IndexOptionsDocument();
            idxOption.Add("background", model.Background);
            idxOption.Add("dropdups", model.Dropdups);

            var mongo = new MongoClient(string.Format(MongoConst.ConnString, Server.Name));
            var server = mongo.GetServer();
            var db = server.GetDatabase(Database.Name);

            var tbl = db.GetCollection(Table.Name);
            var rst = tbl.CreateIndex(idxDoc, idxOption);

            MongoCache.Clear();
        }
        public void TestIndexOptionsDocumentConstructor()
        {
            var document1 = new IndexOptionsDocument(dictionary);
            var document2 = new IndexOptionsDocument(hashtable);
            var document3 = new IndexOptionsDocument(idictionaryNonGeneric);
            var document4 = new IndexOptionsDocument(idictionary);

            Assert.AreEqual("Dictionary<string, object>", document1["type"].AsString);
            Assert.AreEqual("Hashtable", document2["type"].AsString);
            Assert.AreEqual("IDictionary", document3["type"].AsString);
            Assert.AreEqual("IDictionary<string, object>", document4["type"].AsString);
        }