Esempio n. 1
0
        public void VirtualField_Test()
        {
            using (var db = new VirtualFieldDatabase())
            {
                var col = db.GetCollection<VirtualFieldEntity>("col1");

                col.Insert(new VirtualFieldEntity { Name = "John" });
                col.Insert(new VirtualFieldEntity { Name = "Doe" });
                col.Insert(new VirtualFieldEntity { Name = "#1" });

                // auto create index "name_length"
                var q = col.FindOne(Query.EQ("name_length", 4));

                Assert.IsNotNull(q);
                Assert.AreEqual("John", q.Name);
            }
        }
Esempio n. 2
0
        public void VirtualField_Test()
        {
            using (var db = new VirtualFieldDatabase())
            {
                var col = db.GetCollection <VirtualFieldEntity>("col1");

                col.Insert(new VirtualFieldEntity {
                    Name = "John"
                });
                col.Insert(new VirtualFieldEntity {
                    Name = "Doe"
                });
                col.Insert(new VirtualFieldEntity {
                    Name = "#1"
                });

                // auto create index "name_length"
                var q = col.FindOne(Query.EQ("name_length", 4));

                Assert.IsNotNull(q);
                Assert.AreEqual("John", q.Name);
            }
        }