CreateIndex() public method

public CreateIndex ( Document fieldsAndDirections, bool unique ) : void
fieldsAndDirections Document
unique bool
return void
        public void TestCreateIndexNoNames()
        {
            CollectionMetaData cmd = db["tests"]["indextests"].MetaData;

            cmd.CreateIndex(new Document().Append("lname", IndexOrder.Ascending).Append("fname", IndexOrder.Ascending), true);
            Dictionary <string, Document> indexes = cmd.Indexes;

            Assert.IsNotNull(indexes["_lname_fname_unique_"]);
        }
        public void TestCreateIndex()
        {
            CollectionMetaData cmd = db["tests"]["indextests"].MetaData;

            cmd.CreateIndex("lastnames", new Document().Append("lname", IndexOrder.Ascending), false);
            Dictionary <string, Document> indexes = cmd.Indexes;

            Assert.IsNotNull(indexes["lastnames"]);
        }
        public void TestDropIndex()
        {
            CollectionMetaData cmd = db["tests"]["indextests"].MetaData;

            cmd.CreateIndex("firstnames", new Document().Append("fname", IndexOrder.Ascending), false);
            Dictionary <string, Document> indexes = cmd.Indexes;

            Assert.IsNotNull(indexes["firstnames"]);
            cmd.DropIndex("firstnames");
            Assert.IsFalse(cmd.Indexes.ContainsKey("firstnames"));
        }