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


C# BSONDocument类代码示例

本文整理汇总了C#中BSONDocument的典型用法代码示例。如果您正苦于以下问题:C# BSONDocument类的具体用法?C# BSONDocument怎么用?C# BSONDocument使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: UpdateEntry

 public UpdateEntry(BSONDocument query, BSONDocument update, bool multi, bool upsert)
 {
   Query  = query;
   Update = update;
   Multi  = multi;
   Upsert = upsert;
 }
开发者ID:vlapchenko,项目名称:nfx,代码行数:7,代码来源:CRUDObjects.cs

示例2: btnCreateIndex_Click

        private void btnCreateIndex_Click(object sender, EventArgs e)
        {
            var db = MongoClient.Instance.DefaultLocalServer["db1"];

            var idx = new BSONDocument(@"
              {
               createIndexes: 't1',
            indexes: [
              {
                key: {name: 1},
                name: 'idxT1_Name',
                unique: false
              },
              {
                key: {age: -11},
                name: 'idxT1_Age',
                unique: false
              }
            ]
              }

            ",false);

            MessageBox.Show( db.RunCommand( idx ).ToString() );
        }
开发者ID:itadapter,项目名称:nfx,代码行数:25,代码来源:MongoConnectorForm.cs

示例3: InferSchema

        public void InferSchema()
        {
            var doc = new BSONDocument();
            doc.Set( new BSONStringElement("FullName", "Alex Bobby") );
            doc.Set( new BSONInt32Element("Age", 123) );
            doc.Set( new BSONBooleanElement("IsGood", true) );

            var c = new RowConverter();

            var schema = c.InferSchemaFromBSONDocument(doc);

            Assert.AreEqual(3, schema.FieldCount);

            Assert.AreEqual(0, schema["FullName"].Order);
            Assert.AreEqual(1, schema["Age"].Order);
            Assert.AreEqual(2, schema["IsGood"].Order);

            Assert.AreEqual(typeof(object), schema["FullName"].NonNullableType);
            Assert.AreEqual(typeof(object), schema["Age"].NonNullableType);
            Assert.AreEqual(typeof(object), schema["IsGood"].NonNullableType);

            var row = new DynamicRow(schema);
            c.BSONDocumentToRow(doc, row, null);

            Assert.AreEqual("Alex Bobby", row[0]);
            Assert.AreEqual(123,          row[1]);
            Assert.AreEqual(true,         row[2]);

            Assert.AreEqual("Alex Bobby", row["FullName"]);
            Assert.AreEqual(123,          row["Age"]);
            Assert.AreEqual(true,         row["IsGood"]);
        }
开发者ID:vlapchenko,项目名称:nfx,代码行数:32,代码来源:RowConverterTest.cs

示例4: TestFilteredDoc

 public void TestFilteredDoc()
 {
     var doc = new BSONDocument();
     doc["c"] = "d";
     doc["aaa"] = 11;
     doc["ndoc"] = BSONDocument.ValueOf(new {
         aaaa = "nv1",
         d = "nv2",
         nnd = BSONDocument.ValueOf(new {
             nnv = true,
             nns = "s"
         })
     });
     doc["ndoc2"] = BSONDocument.ValueOf(new {
         n = "v"
     });
     doc["f"] = "f";
     BSONIterator it = new BSONIterator(doc);
     BSONDocument doc2 = it.ToBSONDocument("c", "ndoc.d", "ndoc.nnd.nns", "f");
     Assert.AreEqual(3, doc2.KeysCount);
     Assert.AreEqual("d", doc2["c"]);
     Assert.AreEqual(2, ((BSONDocument) doc2["ndoc"]).KeysCount);
     Assert.AreEqual("nv2", ((BSONDocument) doc2["ndoc"])["d"]);
     Assert.AreEqual("s", ((BSONDocument) ((BSONDocument) doc2["ndoc"])["nnd"])["nns"]);
     Assert.AreEqual("s", doc2["ndoc.nnd.nns"]);
     Assert.AreEqual("f", "f");
     //Console.WriteLine("doc2=" + doc2);
 }
开发者ID:rayleyva,项目名称:ejdb,代码行数:28,代码来源:TestBSON.cs

示例5: Test3SaveLoad

        public void Test3SaveLoad()
        {
            EJDB jb = new EJDB("testdb1", EJDB.DEFAULT_OPEN_MODE | EJDB.JBOTRUNC);
            Assert.IsTrue(jb.IsOpen);
            BSONDocument doc = new BSONDocument().SetNumber("age", 33);
            Assert.IsNull(doc["_id"]);
            bool rv = jb.Save("mycoll", doc);
            Assert.IsTrue(rv);
            Assert.IsNotNull(doc["_id"]);
            Assert.IsInstanceOf(typeof(BSONOid), doc["_id"]);
            rv = jb.Save("mycoll", doc);
            Assert.IsTrue(rv);

            BSONIterator it = jb.Load("mycoll", doc["_id"] as BSONOid);
            Assert.IsNotNull(it);

            BSONDocument doc2 = it.ToBSONDocument();
            Assert.AreEqual(doc.ToDebugDataString(), doc2.ToDebugDataString());
            Assert.IsTrue(doc == doc2);

            Assert.AreEqual(1, jb.CreateQueryFor("mycoll").Count());
            Assert.IsTrue(jb.Remove("mycoll", doc["_id"] as BSONOid));
            Assert.AreEqual(0, jb.CreateQueryFor("mycoll").Count());

            jb.Save("mycoll", doc);
            Assert.AreEqual(1, jb.CreateQueryFor("mycoll").Count());
            Assert.IsTrue(jb.DropCollection("mycoll"));
            Assert.AreEqual(0, jb.CreateQueryFor("mycoll").Count());

            Assert.IsTrue(jb.Sync());
            jb.Dispose();
        }
开发者ID:JulianLiu,项目名称:ejdb,代码行数:32,代码来源:TestEJDB.cs

示例6: EJDBQuery

 internal EJDBQuery(EJDB jb, BSONDocument qdoc, string defaultcollection = null)
 {
     _qptr = _ejdbcreatequery(jb.DBPtr, qdoc.ToByteArray());
     if (_qptr == IntPtr.Zero) {
         throw new EJDBQueryException(jb);
     }
     _jb = jb;
     _defaultcollection = defaultcollection;
 }
开发者ID:JulianLiu,项目名称:ejdb,代码行数:9,代码来源:EJDBQuery.cs

示例7: WriteBigIntegers

 public void WriteBigIntegers(Stream stream)
 {
     stream.Position = 0;
       var root = new BSONDocument();
       root.Set(new BSONInt32Element("intMin", int.MinValue));
       root.Set(new BSONInt32Element("intMax", int.MaxValue));
       root.Set(new BSONInt64Element("longMin", long.MinValue));
       root.Set(new BSONInt64Element("longMax", long.MaxValue));
       root.WriteAsBSON(stream);
 }
开发者ID:vlapchenko,项目名称:nfx,代码行数:10,代码来源:BSONTestForm.cs

示例8: ReadEmptyDocument

        public void ReadEmptyDocument()
        {
            var src = Convert.FromBase64String(@"BQAAAAA=");

              using (var stream = new MemoryStream(src))
              {
            var root = new BSONDocument(stream);

            Assert.AreEqual(root.ByteSize, 5);
            Assert.AreEqual(root.Count, 0);
            Assert.AreEqual(stream.Position, 5); // ensure whole document readed
              }
        }
开发者ID:vlapchenko,项目名称:nfx,代码行数:13,代码来源:BSON.cs

示例9: FindOne

        /// <summary>
        /// Finds a document that satisfied query or null
        /// </summary>
        public BSONDocument FindOne(Query query, BSONDocument selector = null)
        {
          EnsureObjectNotDisposed();

          if (query==null)
           throw new MongoDBConnectorException(StringConsts.ARGUMENT_ERROR+"Collection.FindOne(query==null)");

          var connection = Server.AcquireConnection();
          try
          {
            var reqId = Database.NextRequestID;
            return connection.FindOne(reqId, this, query, selector);
          }
          finally
          {
            connection.Release();
          }
        }
开发者ID:vlapchenko,项目名称:nfx,代码行数:21,代码来源:Collection.cs

示例10: CollectionDrop

        public void CollectionDrop()
        {
            using(var client= new MongoClient("My Test"))
              {
            var collection = client.DefaultLocalServer["db1"]["ToDrop"];
            var doc1 = new BSONDocument();

            doc1.Set( new BSONStringElement("_id", "id1"))
            .Set( new BSONStringElement("val", "My value"))
            .Set( new BSONInt32Element("age", 125));

            var r = collection.Insert(doc1);
            Assert.AreEqual(1, r.TotalDocumentsAffected);

            collection.Drop();
            Assert.IsTrue( collection.Disposed );
              }
        }
开发者ID:vlapchenko,项目名称:nfx,代码行数:18,代码来源:BasicConnectorFunctionality.cs

示例11: ReadBigIntegers

        public void ReadBigIntegers()
        {
            var src = Convert.FromBase64String(@"PwAAABBpbnRNaW4AAAAAgBBpbnRNYXgA////fxJsb25nTWluAAAAAAAAAACAEmxvbmdNYXgA/////////38A");

              using (var stream = new MemoryStream(src))
              {
            var root = new BSONDocument(stream);

            Assert.AreEqual(root.ByteSize, 63);
            Assert.AreEqual(root.Count, 4);

            var element1 = root["intMin"] as BSONInt32Element;
            Assert.IsNotNull(element1);
            Assert.AreEqual(element1.ElementType, BSONElementType.Int32);
            Assert.AreEqual(element1.Name, "intMin");
            Assert.AreEqual(element1.Value, int.MinValue);

            var element2 = root["intMax"] as BSONInt32Element;
            Assert.IsNotNull(element2);
            Assert.AreEqual(element2.ElementType, BSONElementType.Int32);
            Assert.AreEqual(element2.Name, "intMax");
            Assert.AreEqual(element2.Value, int.MaxValue);

            var element3 = root["longMin"] as BSONInt64Element;
            Assert.IsNotNull(element3);
            Assert.AreEqual(element3.ElementType, BSONElementType.Int64);
            Assert.AreEqual(element3.Name, "longMin");
            Assert.AreEqual(element3.Value, long.MinValue);

            var element4 = root["longMax"] as BSONInt64Element;
            Assert.IsNotNull(element4);
            Assert.AreEqual(element4.ElementType, BSONElementType.Int64);
            Assert.AreEqual(element4.Name, "longMax");
            Assert.AreEqual(element4.Value, long.MaxValue);

            Assert.AreEqual(stream.Position, 63); // ensure whole document readed
              }
        }
开发者ID:itadapter,项目名称:nfx,代码行数:38,代码来源:BSON.cs

示例12: ReadUnicodeStrings

        public void ReadUnicodeStrings()
        {
            var src = Convert.FromBase64String(@"6AAAAAJlbmcABgAAAGhlbGxvAAJydXMADQAAANC/0YDQuNCy0LXRggACY2hpAAcAAADkvaDlpb0AAmphcAAQAAAA44GT44KT44Gr44Gh44GvAAJncmUAEAAAAM6zzrXOuc6xIM+DzrHPggACYWxiAA8AAABww6tyc2jDq25kZXRqZQACYXJtABIAAADVotWh1oDVpdaCINWB1aXVpgACdmllAAoAAAB4aW4gY2jDoG8AAnBvcgAFAAAAT2zDoQACdWtyAA0AAADQn9GA0LjQstGW0YIAAmdlcgAJAAAAd8O8bnNjaGUAAA==");

              using (var stream = new MemoryStream(src))
              {
            var root = new BSONDocument(stream);

            Assert.AreEqual(root.ByteSize, 232);
            Assert.AreEqual(root.Count, 11);

            var element = root["eng"] as BSONStringElement;
            Assert.IsNotNull(element);
            Assert.AreEqual(element.ElementType, BSONElementType.String);
            Assert.AreEqual(element.Name, "eng");
            Assert.AreEqual(element.Value, "hello");

            element = root["rus"] as BSONStringElement;
            Assert.IsNotNull(element);
            Assert.AreEqual(element.ElementType, BSONElementType.String);
            Assert.AreEqual(element.Name, "rus");
            Assert.AreEqual(element.Value, "привет");

            element = root["chi"] as BSONStringElement;
            Assert.IsNotNull(element);
            Assert.AreEqual(element.ElementType, BSONElementType.String);
            Assert.AreEqual(element.Name, "chi");
            Assert.AreEqual(element.Value, "你好");

            element = root["jap"] as BSONStringElement;
            Assert.IsNotNull(element);
            Assert.AreEqual(element.ElementType, BSONElementType.String);
            Assert.AreEqual(element.Name, "jap");
            Assert.AreEqual(element.Value, "こんにちは");

            element = root["gre"] as BSONStringElement;
            Assert.IsNotNull(element);
            Assert.AreEqual(element.ElementType, BSONElementType.String);
            Assert.AreEqual(element.Name, "gre");
            Assert.AreEqual(element.Value, "γεια σας");

            element = root["alb"] as BSONStringElement;
            Assert.IsNotNull(element);
            Assert.AreEqual(element.ElementType, BSONElementType.String);
            Assert.AreEqual(element.Name, "alb");
            Assert.AreEqual(element.Value, "përshëndetje");

            element = root["arm"] as BSONStringElement;
            Assert.IsNotNull(element);
            Assert.AreEqual(element.ElementType, BSONElementType.String);
            Assert.AreEqual(element.Name, "arm");
            Assert.AreEqual(element.Value, "բարեւ Ձեզ");

            element = root["vie"] as BSONStringElement;
            Assert.IsNotNull(element);
            Assert.AreEqual(element.ElementType, BSONElementType.String);
            Assert.AreEqual(element.Name, "vie");
            Assert.AreEqual(element.Value, "xin chào");

            element = root["por"] as BSONStringElement;
            Assert.IsNotNull(element);
            Assert.AreEqual(element.ElementType, BSONElementType.String);
            Assert.AreEqual(element.Name, "por");
            Assert.AreEqual(element.Value, "Olá");

            element = root["ukr"] as BSONStringElement;
            Assert.IsNotNull(element);
            Assert.AreEqual(element.ElementType, BSONElementType.String);
            Assert.AreEqual(element.Name, "ukr");
            Assert.AreEqual(element.Value, "Привіт");

            element = root["ger"] as BSONStringElement;
            Assert.IsNotNull(element);
            Assert.AreEqual(element.ElementType, BSONElementType.String);
            Assert.AreEqual(element.Name, "ger");
            Assert.AreEqual(element.Value, "wünsche");

            Assert.AreEqual(stream.Position, 232); // ensure whole document readed
              }
        }
开发者ID:itadapter,项目名称:nfx,代码行数:80,代码来源:BSON.cs

示例13: Templatization_ArrayOfUnicodeStringNames

        public void Templatization_ArrayOfUnicodeStringNames()
        {
            var qry0 = new BSONDocument("{ '$$eng': 'eng', '$$rus': 'rus', '$$chi': 'chi', '$$jap': 'jap', '$$gre': 'gre', '$$alb': 'alb', '$$arm': 'arm', '$$vie': 'vie', '$$por': 'por', '$$ukr': 'ukr', '$$ger': 'ger' }", true,
                           new TemplateArg("eng", BSONElementType.String, "hello"),
                           new TemplateArg("rus", BSONElementType.String, "привет"),
                           new TemplateArg("chi", BSONElementType.String, "你好"),
                           new TemplateArg("jap", BSONElementType.String, "こんにちは"),
                           new TemplateArg("gre", BSONElementType.String, "γεια σας"),
                           new TemplateArg("alb", BSONElementType.String, "përshëndetje"),
                           new TemplateArg("arm", BSONElementType.String, "բարեւ Ձեզ"),
                           new TemplateArg("vie", BSONElementType.String, "xin chào"),
                           new TemplateArg("por", BSONElementType.String, "Olá"),
                           new TemplateArg("ukr", BSONElementType.String, "Привіт"),
                           new TemplateArg("ger", BSONElementType.String, "wünsche"));

              Assert.AreEqual(qry0.Count, 11);
              Assert.IsNotNull(qry0["hello"]);
              Assert.IsInstanceOf<BSONStringElement>(qry0["hello"]);
              Assert.AreEqual(((BSONStringElement)qry0["hello"]).Value, "eng");

              Assert.IsNotNull(qry0["привет"]);
              Assert.IsInstanceOf<BSONStringElement>(qry0["привет"]);
              Assert.AreEqual(((BSONStringElement)qry0["привет"]).Value, "rus");

              Assert.IsNotNull(qry0["你好"]);
              Assert.IsInstanceOf<BSONStringElement>(qry0["你好"]);
              Assert.AreEqual(((BSONStringElement)qry0["你好"]).Value, "chi");

              Assert.IsNotNull(qry0["こんにちは"]);
              Assert.IsInstanceOf<BSONStringElement>(qry0["こんにちは"]);
              Assert.AreEqual(((BSONStringElement)qry0["こんにちは"]).Value, "jap");

              Assert.IsNotNull(qry0["γεια σας"]);
              Assert.IsInstanceOf<BSONStringElement>(qry0["γεια σας"]);
              Assert.AreEqual(((BSONStringElement)qry0["γεια σας"]).Value, "gre");

              Assert.IsNotNull(qry0["përshëndetje"]);
              Assert.IsInstanceOf<BSONStringElement>(qry0["përshëndetje"]);
              Assert.AreEqual(((BSONStringElement)qry0["përshëndetje"]).Value, "alb");

              Assert.IsNotNull(qry0["բարեւ Ձեզ"]);
              Assert.IsInstanceOf<BSONStringElement>(qry0["բարեւ Ձեզ"]);
              Assert.AreEqual(((BSONStringElement)qry0["բարեւ Ձեզ"]).Value, "arm");

              Assert.IsNotNull(qry0["xin chào"]);
              Assert.IsInstanceOf<BSONStringElement>(qry0["xin chào"]);
              Assert.AreEqual(((BSONStringElement)qry0["xin chào"]).Value, "vie");

              Assert.IsNotNull(qry0["Olá"]);
              Assert.IsInstanceOf<BSONStringElement>(qry0["Olá"]);
              Assert.AreEqual(((BSONStringElement)qry0["Olá"]).Value, "por");

              Assert.IsNotNull(qry0["Привіт"]);
              Assert.IsInstanceOf<BSONStringElement>(qry0["Привіт"]);
              Assert.AreEqual(((BSONStringElement)qry0["Привіт"]).Value, "ukr");

              Assert.IsNotNull(qry0["wünsche"]);
              Assert.IsInstanceOf<BSONStringElement>(qry0["wünsche"]);
              Assert.AreEqual(((BSONStringElement)qry0["wünsche"]).Value, "ger");
        }
开发者ID:itadapter,项目名称:nfx,代码行数:60,代码来源:BSON.cs

示例14: Templatization_ArrayOfUnicodeStringValues

        public void Templatization_ArrayOfUnicodeStringValues()
        {
            var qry0 = new BSONDocument("{ '$$unicode': [ '$$eng', '$$rus', '$$chi', '$$jap', '$$gre', '$$alb', '$$arm', '$$vie', '$$por', '$$ukr', '$$ger' ] }", true,
                           new TemplateArg("unicode", BSONElementType.String, "strings"),
                           new TemplateArg("eng", BSONElementType.String, "hello"),
                           new TemplateArg("rus", BSONElementType.String, "привет"),
                           new TemplateArg("chi", BSONElementType.String, "你好"),
                           new TemplateArg("jap", BSONElementType.String, "こんにちは"),
                           new TemplateArg("gre", BSONElementType.String, "γεια σας"),
                           new TemplateArg("alb", BSONElementType.String, "përshëndetje"),
                           new TemplateArg("arm", BSONElementType.String, "բարեւ Ձեզ"),
                           new TemplateArg("vie", BSONElementType.String, "xin chào"),
                           new TemplateArg("por", BSONElementType.String, "Olá"),
                           new TemplateArg("ukr", BSONElementType.String, "Привіт"),
                           new TemplateArg("ger", BSONElementType.String, "wünsche"));

              Assert.AreEqual(qry0.Count, 1);
              Assert.IsNotNull(qry0["strings"]);
              Assert.IsInstanceOf<BSONArrayElement>(qry0["strings"]);
              var array = ((BSONArrayElement)qry0["strings"]).Value;
              Assert.IsNotNull(array);
              Assert.AreEqual(array.Length, 11);
              Assert.AreEqual(((BSONStringElement)array[0]).Value, "hello");
              Assert.AreEqual(((BSONStringElement)array[1]).Value, "привет");
              Assert.AreEqual(((BSONStringElement)array[2]).Value, "你好");
              Assert.AreEqual(((BSONStringElement)array[3]).Value, "こんにちは");
              Assert.AreEqual(((BSONStringElement)array[4]).Value, "γεια σας");
              Assert.AreEqual(((BSONStringElement)array[5]).Value, "përshëndetje");
              Assert.AreEqual(((BSONStringElement)array[6]).Value, "բարեւ Ձեզ");
              Assert.AreEqual(((BSONStringElement)array[7]).Value, "xin chào");
              Assert.AreEqual(((BSONStringElement)array[8]).Value, "Olá");
              Assert.AreEqual(((BSONStringElement)array[9]).Value, "Привіт");
              Assert.AreEqual(((BSONStringElement)array[10]).Value, "wünsche");
        }
开发者ID:itadapter,项目名称:nfx,代码行数:34,代码来源:BSON.cs

示例15: Templatization_QueryComplexObject

        public void Templatization_QueryComplexObject()
        {
            var qry0 = new BSONDocument(
            "{" +
              "'$$item1': 23," +
              "item2: [1, '$$item21', 123.456], " +
              "'$$item3': { item31: '$$false', item32: '$$array', item33: {} }," +
              "'$$item4': {" +
            "'$$item41': [1, 2, 3]," +
            "'$$item42': false," +
            "item43: '$$double'," +
            "item44: 'こんこんвапаъü'," +
            "item45: { item451: '$$array2', item452: true, item453: {} }" +
              "} "+
            "}", true,
            new TemplateArg("item1", BSONElementType.String, "item1"),
            new TemplateArg("item21", BSONElementType.String, "こん好արüвіт"),
            new TemplateArg("item3", BSONElementType.String, "item3"),
            new TemplateArg("false", BSONElementType.Boolean, false),
            new TemplateArg("array", BSONElementType.Array,
              new BSONElement[]
              {
            new BSONBooleanElement(true),
            new BSONBooleanElement(true),
            new BSONBooleanElement(false)
              }),
            new TemplateArg("item4", BSONElementType.String, "item4"),
            new TemplateArg("item41", BSONElementType.String, "item41"),
            new TemplateArg("item42", BSONElementType.String, "item42"),
            new TemplateArg("double", BSONElementType.Double, -123.4567),
            new TemplateArg("array2", BSONElementType.Array,
              new BSONElement[]
              {
            new BSONInt64Element(2),
              })
            );

              Assert.AreEqual(qry0.Count, 4);

              Assert.AreEqual(((BSONInt32Element)qry0["item1"]).Value, 23);

              var item2 = ((BSONArrayElement)qry0["item2"]).Value;
              Assert.AreEqual(item2.Length, 3);
              Assert.AreEqual(((BSONInt32Element)item2[0]).Value, 1);
              Assert.AreEqual(((BSONStringElement)item2[1]).Value, "こん好արüвіт");
              Assert.AreEqual(((BSONDoubleElement)item2[2]).Value, 123.456D);

              var item3 = ((BSONDocumentElement)qry0["item3"]).Value;
              Assert.AreEqual(item3.Count, 3);
              Assert.AreEqual(((BSONBooleanElement)item3["item31"]).Value, false);
              var arr = ((BSONArrayElement)item3["item32"]).Value;
              Assert.AreEqual(arr.Length, 3);
              Assert.AreEqual(((BSONBooleanElement)arr[0]).Value, true);
              Assert.AreEqual(((BSONBooleanElement)arr[1]).Value, true);
              Assert.AreEqual(((BSONBooleanElement)arr[2]).Value, false);
              var item33 =  ((BSONDocumentElement)item3["item33"]).Value;
              Assert.AreEqual(item33.Count, 0);

              var item4 = ((BSONDocumentElement)qry0["item4"]).Value;
              Assert.AreEqual(item4.Count, 5);
              var item41 = ((BSONArrayElement)item4["item41"]).Value;
              Assert.AreEqual(item41.Length, 3);
              Assert.AreEqual(((BSONInt32Element)item41[0]).Value, 1);
              Assert.AreEqual(((BSONInt32Element)item41[1]).Value, 2);
              Assert.AreEqual(((BSONInt32Element)item41[2]).Value, 3);
              Assert.AreEqual(((BSONBooleanElement)item4["item42"]).Value, false);
              Assert.AreEqual(((BSONDoubleElement)item4["item43"]).Value, -123.4567D);
              Assert.AreEqual(((BSONStringElement)item4["item44"]).Value, "こんこんвапаъü");

              var item45 = ((BSONDocumentElement)item4["item45"]).Value;
              Assert.AreEqual(item45.Count, 3);
              var item451 = ((BSONArrayElement)item45["item451"]).Value;
              Assert.AreEqual(item451.Length, 1);
              Assert.AreEqual(((BSONInt64Element)item451[0]).Value, 2);
              Assert.AreEqual(((BSONBooleanElement)item45["item452"]).Value, true);

              var item453 =  ((BSONDocumentElement)item45["item453"]).Value;
              Assert.AreEqual(item453.Count, 0);
        }
开发者ID:itadapter,项目名称:nfx,代码行数:79,代码来源:BSON.cs


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