Exemplo n.º 1
0
        public void Evaluation()
        {
            // find all people in their 80s
            Console.WriteLine(Query.Mod("age", 10, 8));
            // find all people who have a first name starting with A
            Console.WriteLine(Query.Matches("name", new Regex("^[aA]")));

            // arbitrary javascript, slow! use in conjunction with non where queries that hit an index or really narrow down documents first
            var where = Query.Where("this.age === 1");
            Console.WriteLine(where);
            Console.WriteLine("where matches:");
            QueryTests.Insert(new BsonDocument {
                { "age", 2 }
            });
            QueryTests.Insert(new BsonDocument {
                { "age", 1 }
            });
            QueryTests.Find(where)
            .ToList()
            .ForEach(Console.WriteLine);
        }