views:

38

answers:

2

I have a model defined as

public class Department
    {
        [ScaffoldColumn(false)]
        public object Id { get; set; }

        [Required(ErrorMessage = "Department Name is required")]
        [StringLength(25)]
        [DisplayName("Department Name")]
        public string Name { get; set; }

        [DefaultValue(true)]
        [DisplayName("Active?")]            
        public bool Active { get; set; }
    }

i have added one record using the asp.net view. To retrieve the records i have created a simple index "DepartmentIndex" as

from dept in docs.Departments
select new {dept.Id,dept.Name}

To fetch the records I am using the following linq query

var depts = dbSession.Query<Department>("DepartmentIndex").OrderByDescending(x => x.Id);            

Till here everything is fine. I can see the first record I have added on my view page. But, when I start adding more records i don't see the newly added ones. What have I missed?

A: 

RavenDB updates indexes in the background, so the results might be stale. See the documentation here for more info. In the client API you need to call the function WaitForNonStaleResults, to do this.

Matt Warren
@Matt i tried but it didn't work :( I changed the query to dbSession.Query<Department>("DepartmentIndex").Customize(x=>x.WaitForNonStaleResults()) hope this is the correct way?
ajay_whiz
A: 

I was using build #133 i upgraded to #140 now, this doesn't seems to be a problem.

ajay_whiz