当前位置: 首页>>代码示例>>C#>>正文


C# Document.Contains方法代码示例

本文整理汇总了C#中MongoDB.Driver.Document.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# Document.Contains方法的具体用法?C# Document.Contains怎么用?C# Document.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MongoDB.Driver.Document的用法示例。


在下文中一共展示了Document.Contains方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestRemove

 public void TestRemove()
 {
     Document d = new Document();
     d["one"] = 1;
     d.Remove("one");
     Assert.IsFalse(d.Contains("one"));
 }
开发者ID:jesseemerick,项目名称:mongodb-csharp,代码行数:7,代码来源:TestDocument.cs

示例2: DBRef

 /// <summary>
 /// Constructs a DBRef from a document that matches the DBref specification.
 /// </summary>
 public DBRef(Document document)
 {
     if(IsDocumentDBRef(document) == false) throw new ArgumentException("Document is not a valid DBRef");
     collectionName = (String)document[RefName];
     id = document[IdName];
     this.document = document;
     if(document.Contains("metadata")) this.MetaData = (Document)document["metadata"];
 }
开发者ID:ningliaoyuan,项目名称:Antaeus,代码行数:11,代码来源:DBRef.cs

示例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];
     }
 }
开发者ID:ningliaoyuan,项目名称:Antaeus,代码行数:12,代码来源:Document.cs

示例4: TestClearRemovesAll

 public void TestClearRemovesAll()
 {
     Document d = new Document();
     d["one"] = 1;
     d.Add("two", 2);
     d["three"] = 3;
     Assert.AreEqual(3,d.Count);
     d.Clear();
     Assert.AreEqual(0, d.Count);
     Assert.IsNull(d["one"]);
     Assert.IsFalse(d.Contains("one"));
 }
开发者ID:sdether,项目名称:mongodb-csharp,代码行数:12,代码来源:TestDocument.cs

示例5: Update

 public void Update(Document doc)
 {
     //Try to generate a selector using _id for an existing document.
     //otherwise just set the upsert flag to 1 to insert and send onward.
     Document selector = new Document();
     int upsert = 0;
     if(doc.Contains("_id")  & doc["_id"] != null){
         selector["_id"] = doc["_id"];
     }else{
         //Likely a new document
         doc["_id"] = oidGenerator.Generate();
         upsert = 1;
     }
     this.Update(doc, selector, upsert);
 }
开发者ID:qjlee,项目名称:mongodb-csharp,代码行数:15,代码来源:Collection.cs

示例6: UpdateObjectAlwaysUpsert

 //If _id exists but has changed save new object
 private void UpdateObjectAlwaysUpsert(string collectionName, Document doc, Mong db)
 {
     if(doc.Contains("_id") && doc["_id"] != null)
     {
         var selector = new Document();
         selector["_id"] = doc["_id"];
         db[DataBaseName][collectionName].Update(doc,selector,1);
     }
     else
         db[DataBaseName][collectionName].Update(doc);
 }
开发者ID:okku,项目名称:Mongdio,代码行数:12,代码来源:MongoEditorSession.cs

示例7: IsError

 /// <summary>
 /// Determines whether the specified document is error.
 /// </summary>
 /// <param name="document">The document.</param>
 /// <returns>
 /// 	<c>true</c> if the specified document is error; otherwise, <c>false</c>.
 /// </returns>
 public static bool IsError(Document document)
 {
     if(document.Contains("err") && document["err"] != DBNull.Value)
         return true;
     return false;
 }
开发者ID:deadtrickster,项目名称:mongodb-csharp,代码行数:13,代码来源:ErrorTranslator.cs

示例8: IsDocumentDBRef

 public static bool IsDocumentDBRef(Document doc)
 {
     return doc != null && doc.Contains(RefName) && doc.Contains(IdName);
 }
开发者ID:ningliaoyuan,项目名称:Antaeus,代码行数:4,代码来源:DBRef.cs

示例9: IsDocumentDBRef

 public static bool IsDocumentDBRef(Document doc)
 {
     return doc.Contains("$ref") && doc.Contains("$id");
 }
开发者ID:sbos,项目名称:mongodb-csharp,代码行数:4,代码来源:DBRef.cs


注:本文中的MongoDB.Driver.Document.Contains方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。