Snoopy111
Snoopy111

Reputation: 212

Filter RavenDB query by entries of list

I am working with the python client for ravendb

My goal is to select unique Types and their TypeCount in a certain range of DateTime

Currently I have the following Map and Reduce: enter image description here

and this gives me the following results: enter image description here

Now I want to be able to select this in a certain DateTime range. For example, if we only take the BTE type into account, if I would say something along the lines of where Dates > "2020-02-09", I'd want to get the following results: Type = BTE, TypeCount = 2, Dates = ["2020-02-09T00:50:07.0000890", "2020-02-09T00:59:41.0000210"

Upvotes: 3

Views: 96

Answers (1)

garay
garay

Reputation: 666

You can achieve this by removing the Reduce part of the index and change Dates to Date = pds.DateTime, then you can query the index like this:

var queryResult = session.Query<Index.Result, Index>()
                        .Where(x => x.Type == "BTE" && x.Date > new DateTime(2020, 2, 9))
                        .ToList();

Upvotes: 1

Related Questions