I have a requirement for uniqueness of a document in a RavenDb database. So I followed the recomendation in docs –
http://ravendb.net/faq/unique-constraints
I also use the following code to get count of entities
public int GetCount<T>()
{
RavenQueryStatistics stats;
_session.Query<T>().Customize(x=> x.WaitForNonStaleResultsAsOfLastWrite()).Statistics(out stats).Take(0).ToArray();
return(stats.TotalResults);
//IQueryable<T> queryable = from p in _session.Query<T>().Customize(x => x.WaitForNonStaleResultsAsOfLastWrite())
// select p;
//return queryable.Count();
}
When I use my own ID like Docs/Doc_1 then the TotalResults in way higher than actual documents in the database. When I browse it in the studio the document lower than TotalResults but the collections show higher number corresponding to TotalResults.
Looking at the other fields in RavenQueryStatistics class I found SkippedResults the correct answer for count is always TotalResults – SkipperResults . I found the following link in the documents to explain SkipperResults but in my scenario it does not clarify.
http://ravendb.net/faq/skipped-results
I think I am missing some fundamental ravendb concept. Any body has had similar experience?
That sounds strange, and shouldn’t really happen.
Can you try creating a failing test for this and send that to the mailing list?