/// <exception cref="Couchbase.Lite.CouchbaseLiteException"></exception> public virtual void TestDeleteDocument() { Document document = database.CreateDocument(); IDictionary <string, object> properties = new Dictionary <string, object>(); properties.Put("foo", "foo"); properties.Put("bar", false); document.PutProperties(properties); NUnit.Framework.Assert.IsNotNull(document.GetCurrentRevision()); string docId = document.GetId(); document.Delete(); NUnit.Framework.Assert.IsTrue(document.IsDeleted()); Document fetchedDoc = database.GetExistingDocument(docId); NUnit.Framework.Assert.IsNull(fetchedDoc); // query all docs and make sure we don't see that document database.GetAllDocs(new QueryOptions()); Query queryAllDocs = database.CreateAllDocumentsQuery(); QueryEnumerator queryEnumerator = queryAllDocs.Run(); for (IEnumerator <QueryRow> it = queryEnumerator; it.HasNext();) { QueryRow row = it.Next(); NUnit.Framework.Assert.IsFalse(row.GetDocument().GetId().Equals(docId)); } }
public void Test11DeleteDocs() { RunTest("Test11DeleteDocs", (parameters) => { var numDocs = Convert.ToInt32(parameters[NUMDOCS_KEY]); var docSize = Convert.ToInt32(parameters[DOCSIZE_KEY]); var docs = new Document[numDocs]; database.RunInTransaction(() => { var props = CreateTestProperties(docSize); for (var i = 0; i < docs.Length; i++) { var doc = database.CreateDocument(); doc.PutProperties(props); docs[i] = doc; } return(true); }); var stopwatch = Stopwatch.StartNew(); database.RunInTransaction(() => { for (int i = 0; i < docs.Length; i++) { Document doc = docs[i]; doc.Delete(); } return(true); }); stopwatch.Stop(); return(stopwatch.ElapsedMilliseconds); }); }
public void DeleteDocumentWithID(string ID) { doc = database.GetDocument(ID); doc.Delete(); }
/// <exception cref="Couchbase.Lite.CouchbaseLiteException"></exception> public static void DeleteTask(Couchbase.Lite.Document task) { task.Delete(); }