ResetError() публичный Метод

Resets last error. This is good to call before a bulk operation.
public ResetError ( ) : void
Результат void
Пример #1
0
        public void TestGetPrevError()
        {
            IMongoCollection col = db["preverror"];

            col.MetaData.CreateIndex(new Document()
            {
                { "x", IndexOrder.Ascending }
            }, true);
            List <Document> docs = new List <Document>();

            for (int x = 0; x < 10; x++)
            {
                docs.Add(new Document()
                {
                    { "x", x }, { "y", 2 }
                });
            }
            docs.Add(new Document()
            {
                { "x", 1 }, { "y", 4 }
            });                                        //the dupe
            db.ResetError();
            Assert.AreEqual(MongoDBNull.Value, db.GetLastError()["err"]);

            col.Insert(docs);
            Document error = db.GetLastError();

            Assert.IsFalse(MongoDBNull.Value == error["err"]);
            Console.WriteLine(error);
        }