feanz
2/6/2015 - 4:24 PM

Example issue with mongo client version 1.

Example issue with mongo client version 1.

 public class program
    {
        static void Main(string[] args)
        {
            var client = new MongoClient("mongodb://localhost:27016");
            try
            {
                var server = client.GetServer();

                var database = server.GetDatabase("testv1");

                var customers = database.GetCollection<Customer>("customer");

                var nextId = 563627090084241408;
                var nextId2 = 563627090084241409;
                
                customers.Insert(new Customer { Name = "Dave", Id = nextId });
                customers.Insert(new Customer { Name = "Steve", Id = nextId2 });

                var query = Query<Customer>.EQ(u => u.Name, "Dave");
                var list = customers.FindAs<Customer>(query);

                foreach (var person in list)
                {
                    Console.WriteLine(person.Name);
                }
            }
            catch (Exception)
            {

                throw;
            }
        } 
    }

   

    public class Customer
    {
        public long Id { get; set; }
        public string Name { get; set; }
    }