本文整理汇总了C#中MongoDB.Driver.Document.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# Document.Remove方法的具体用法?C# Document.Remove怎么用?C# Document.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MongoDB.Driver.Document
的用法示例。
在下文中一共展示了Document.Remove方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestRemove
public void TestRemove()
{
Document d = new Document();
d["one"] = 1;
d.Remove("one");
Assert.IsFalse(d.Contains("one"));
}
示例2: TestKeyOrderPreservedOnRemove
public void TestKeyOrderPreservedOnRemove()
{
Document d = new Document();
d["one"] = 1;
d["onepointfive"] = 1.5;
d.Add("two", 2);
d.Add("two.5", 2.5);
d.Remove("two.5");
d["three"] = 3;
d.Remove("onepointfive");
int cnt = 1;
foreach(String key in d.Keys){
Assert.AreEqual(cnt, d[key]);
cnt++;
}
}
示例3: CopyTo
/// <summary>
/// TODO Fix any accidental reordering issues.
/// </summary>
/// <param name="dest"></param>
public void CopyTo(Document dest)
{
foreach (String key in orderedKeys) {
if (dest.Contains (key))
dest.Remove (key);
dest[key] = this[key];
}
}
示例4: TestIsDocumentDBRef
public void TestIsDocumentDBRef()
{
Document doc = new Document();
Assert.IsFalse(DBRef.IsDocumentDBRef(null));
Assert.IsFalse(DBRef.IsDocumentDBRef(doc));
doc[DBRef.RefName] = "tests";
Assert.IsFalse(DBRef.IsDocumentDBRef(doc));
doc.Remove(DBRef.RefName);
doc[DBRef.IdName] = "12312131";
Assert.IsFalse(DBRef.IsDocumentDBRef(doc));
doc[DBRef.RefName] = "tests";
Assert.IsTrue(DBRef.IsDocumentDBRef(doc));
}