Raven DB Count Queries

I need to get a document graph in a specific collection:

There is an existing Raven / DocumentCollections index that stores the account and name of the collection, paired with the actual documents that belong to the collection. I would like to select an account from this index, if possible.

The following is the Map-Reduce index of the Raven / DocumentCollections index:

from doc in docs
let Name = doc["@metadata"]["Raven-Entity-Name"]
where Name != null
select new { Name , Count = 1}

from result in results
group result by result.Name into g
select new { Name = g.Key, Count = g.Sum(x=>x.Count) }

On the side, the note var Count = DocumentSession.Query<Post>().Count();always returns 0 as the result for me, although it’s clear that there are 500 odd documents in my database, and 50 of them have “Raven-Entity-Name” in their metadata as “Posts”, I absolutely don’t know why this Count query returns 0 as an answer. Raven magazines show this when Count is done

Request # 106: GET     -     0 ms - TestStore  - 200 - /indexes/dynamic/Posts?query=&start=0&pageSize=1&aggregation=None
+5
2

, :

session.Query<Collection>("Raven/DocumentCollections")
       .Where(x=>x.Name == "Posts")
       .FirstOrDefault();

, .

+5

, ( 2011 ), :

var numPosts = session.Query<Post>().Count();

, ...

+7

All Articles