Ejemplo n.º 1
0
        public void UpdateMultiple()
        {
            GEPMongoDacHelper dac = new GEPMongoDacHelper("test", "book");

            QueryComplete query = Query.In("_id"
                , BsonValue.Create(6)
                , BsonValue.Create(7)
            );

            List<Book3> books = dac.Find<Book3>(query).ToList();

            foreach (Book3 book in books)
            {
                book.Age += Convert.ToInt32(book._id);
                dac.Save<Book3>(book);
            }

            UpdateBuilder update = Update.Set("tt", "1");
            dac.GetCollection().Update(query, update, UpdateFlags.Multi);
        }
Ejemplo n.º 2
0
        public void PagingTest()
        {
            int take = 1;
            int skip = 1 * take;

            IMongoQuery query = Query.And(
                Query.EQ("nm", "꽃미남4")
            );

            GEPMongoDacHelper dac = new GEPMongoDacHelper("test", "book");

            MongoCursor<Book> cursor = dac.GetCollection().FindAs<Book>(query);

            Trace.WriteLine(cursor.Count().ToString());

            //if (take >= 0)
            //    cursor.SetLimit(take);

            //if (skip >= 0)
            //    cursor.SetSkip(take);

            //IQueryable<Book> asQueryable = cursor.AsQueryable<Book>();
        }