Another great feature offered by the session is the querying support. The
Query method is an entry point to build a query that will be used to look for files on a file system according to the specified criteria.
IAsyncFilesQuery interface containing additional query methods and extensions.
Query method returns an object that allows you to construct a query by using available predicates and logical operators.
In order to get the results you need to materialize the query by using one of the following methods:
The querying API is the same as the rest of RavenFS client methods, which means it exposes only the asynchronous methods.
Default page size
The default value of a page size for a query is 1024 results. In order to retrieve a different number of results in a single query use the
If there are fewer than 1024 files in a file system, the below code will return all of them because the query does not contain any filtering condition. If there are more than 1024 files, it will return only the first 1024 results according to the default value of the
List<FileHeader> files = await session.Query().ToListAsync();
In this example we will get the first file that has less than 100 bytes or
null if no such file does not exist.
FileHeader file = await session
.WhereLessThan(x => x.TotalSize, 100)