public void Cursor()
        {

            Helper.DropAllCollections();

            for (int i = 0; i < 50; i++)
            {
                Country c = new Country();
                c.Code = "C" + i.ToString();
                c.Name = "Name" + i.ToString();
                c.Save();
            }

            CountryCollection col = new CountryCollection();
            col.Find().Sort(col.Sort.Descending("Code"));
       
            Console.WriteLine(col.Count);

            foreach (var c in col)
            {
                Console.WriteLine(c.Code);
            }

            col.AddIncludeFields("Code");
            col.AddExcludeFields("Name");
            col.Find(C=>C.Name, "Name%");

            foreach (var c in col)
            {
                Console.WriteLine(c.Code + " | " + c.Name);
            }

        }
예제 #2
0
        public void Cursor()
        {
            Helper.DropAllCollections();

            for (int i = 0; i < 50; i++)
            {
                Country c = new Country();
                c.Code = "C" + i.ToString();
                c.Name = "Name" + i.ToString();
                c.Save();
            }

            CountryCollection col = new CountryCollection();

            col.Find().Sort(col.Sort.Descending("Code"));

            Console.WriteLine(col.Count);

            foreach (var c in col)
            {
                Console.WriteLine(c.Code);
            }

            col.AddIncludeFields("Code");
            col.AddExcludeFields("Name");
            col.Find(C => C.Name, "Name%");

            foreach (var c in col)
            {
                Console.WriteLine(c.Code + " | " + c.Name);
            }
        }