RavenDB index doesnt show new data
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?
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.
I was using build #133 i upgraded to #140 now, this doesn't seems to be a problem.
精彩评论