コード例 #1
0
        public void TestCreateIndexNoNames()
        {
            CollectionMetadata cmd = DB["indextests"].Metadata;

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

            Assert.IsNotNull(indexes["_lname_fname_unique_"]);
        }
コード例 #2
0
        public void TestCreateIndex()
        {
            CollectionMetadata cmd = DB["indextests"].Metadata;

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

            Assert.IsNotNull(indexes["lastnames"]);
        }
コード例 #3
0
        public void TestDropIndex()
        {
            CollectionMetadata cmd = DB["indextests"].Metadata;

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

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