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

Gets the document that a reference is pointing to.
public FollowReference ( DBRef reference ) : Document
reference DBRef
Результат Document
Пример #1
0
        public void TestFollowNonReference()
        {
            Database tests = mongo["tests"];
            Oid      id    = new Oid("BAD067c30a57000000008ecb");
            DBRef    rf    = new DBRef("reads", id);

            Document target = tests.FollowReference(rf);

            Assert.IsNull(target, "FollowReference returned wasn't null");
        }
Пример #2
0
        public void TestFollowReference()
        {
            Database tests = mongo["tests"];
            Oid      id    = new Oid("4a7067c30a57000000008ecb");
            DBRef    rf    = new DBRef("reads", id);

            Document target = tests.FollowReference(rf);

            Assert.IsNotNull(target, "FollowReference returned null");
            Assert.IsTrue(target.Contains("j"));
            Assert.AreEqual((double)9980, (double)target["j"]);
        }
Пример #3
0
        public void TestReferenceNonOid()
        {
            Database         tests = mongo["tests"];
            IMongoCollection refs  = tests["refs"];

            Document doc = new Document().Append("_id", 123).Append("msg", "this has a non oid key");

            refs.Insert(doc);

            DBRef rf = new DBRef("refs", 123);

            Document recv = tests.FollowReference(rf);

            Assert.IsNotNull(recv);
            Assert.IsTrue(recv.Contains("msg"));
            Assert.AreEqual(recv["_id"], (long)123);
        }