MongoDB.DriverUnitTests.MongoCollectionTests.TestSetHintByIndexName C# (CSharp) Метод

TestSetHintByIndexName() приватный Метод

private TestSetHintByIndexName ( ) : void
Результат void
        public void TestSetHintByIndexName()
        {
            _collection.DropAllIndexes();
            _collection.RemoveAll();
            _collection.Insert(new BsonDocument { { "x", 1 }, { "y", 2 } });
            _collection.CreateIndex(IndexKeys.Ascending("x"), IndexOptions.SetName("xIndex"));
            var query = Query.EQ("x", 1);
            var cursor = _collection.Find(query).SetHint("xIndex");
            var count = 0;
            foreach (var document in cursor)
            {
                Assert.AreEqual(1, ++count);
                Assert.AreEqual(1, document["x"].AsInt32);
            }
        }