Text queries
A compact filter language shared by the SDK, the REST API and the Management UI - useful when a query arrives as text, for example from a user or a configuration file.
Filter strings
Pass a filter string to ListAsync, FirstOrDefaultAsync, CountAsync,
AnyAsync or Query().Where(string). The syntax is the Management UI's query language.
Operators
| Operator | Example |
|---|---|
| == | Country == "BE" |
| != | Status != "cancelled" |
| >, >=, <, <= | Total >= 100 && LineCount < 5 |
| && | Country == "BE" && Status == "shipped" |
| like | CustomerName like "Acme%" |
| not like | Reference not like "TMP%" |
| in | Country in ("BE", "NL", "DE") |
| skip / limit | Status == "open" skip 20 limit 10 |
| order by | Country == "BE" order by Total desc limit 25 |
Examples
Single property
Match one field to a literal value.
Country == "BE"
await orders.ListAsync("Country == \"BE\"");Multiple conditions
Combine predicates with &&.
Country == "BE" && Status == "shipped" && Total >= 500
await orders.Query()
.Where("Country == \"BE\" && Status == \"shipped\" && Total >= 500")
.ToListAsync();Wildcard search
Use like with % as in SQL.
CustomerName like "Net%"
await orders.FirstOrDefaultAsync("CustomerName like \"Net%\"");Paging
Skip and limit can appear in any order after the filter.
Status == "open" skip 10 limit 25
await orders.ListAsync("Status == \"open\" skip 10 limit 25");Sorting
Order results before paging.
Country == "BE" order by Total desc limit 10
await orders.ListAsync("Country == \"BE\" order by Total desc limit 10");Document metadata
Filter on system fields with the Meta. prefix:
await orders.ListAsync("Meta.CreatedAt >= DateTime(\"2025-01-01T00:00:00Z\")");
// Meta.Id uses the document identifier string
await orders.FirstOrDefaultAsync("Meta.Id == \"b549ea4b-0040-4d16-9dfe-0c6c06ca16fa\"");
SELECT projections
IDocumentCollection<T>.SelectAsync returns selected fields instead of whole documents, optionally as raw
rows without the document metadata wrapper. where, order by, skip and
limit combine as in filter strings.
var collection = host.Services.GetRequiredService<IDocumentCollection<Order>>();
// Project fields
var rows = await collection.SelectAsync(
"select Reference, CustomerName, Total where Country == \"BE\" limit 50");
// Raw rows (no document metadata wrapper)
var raw = await collection.SelectAsync(
"select raw Reference, Total where Status == \"open\"");
UPDATE and DELETE
Text mutations run through QueryAsync on IDocumentCollection<T>:
var collection = host.Services.GetRequiredService<IDocumentCollection<Order>>();
await collection.QueryAsync(
"update set Status = \"archived\" where Country == \"BE\" && Meta.CreatedAt < DateTime(\"2024-01-01T00:00:00Z\")");
await collection.QueryAsync("delete where Status == \"cancelled\"");
delete * truncates the whole collection. Every other delete requires an explicit where clause.
Query bounds
Text queries are parsed under limits - parser depth, token count, path depth, literal length, in-list size
and result-set size - so a pathological query is refused instead of exhausting the process. See
Diagnostics.