Browse the documentation

LINQ queries

The fluent, strongly typed query API.

Fluent queries

Query() composes filters with Where, sorts with OrderBy / OrderByDescending, and pages with Skip / Take. Several Where calls combine with a logical and. Where also accepts a filter string.

var page = await orders.Query()
    .Where(x => x.Country == "BE")
    .Where(x => x.Total >= 100)
    .OrderByDescending(x => x.Total)
    .Skip(0)
    .Take(25)
    .ToListAsync();

Shortcut methods

These accept either a LINQ predicate or a filter string:

// LINQ predicate
var shipped = await orders.ListAsync(x => x.Status == "shipped");

// Plain-text filter (the same syntax as the Management UI)
var shippedText = await orders.ListAsync("Status == \"shipped\"");

var count = await orders.CountAsync("Country == \"BE\"");
var exists = await orders.AnyAsync(x => x.Total > 10_000);
var first = await orders.FirstOrDefaultAsync(x => x.Reference == "SO-10042");

Supported LINQ patterns

  • Equality and inequality: ==, !=
  • Comparisons: <, >, <=, >=
  • Logical combinations: && and || within one expression; chained Where calls combine with &&
  • String helpers: StartsWith, EndsWith, Contains, and negation with !
  • Nested properties: x.ShippingAddress.City == "Ghent"
await orders.ListAsync(x => x.CustomerName.StartsWith("Cont"));
await orders.ListAsync(x => x.Status != "cancelled");
await orders.ListAsync(x => !x.Reference.EndsWith("-TEMP"));
await orders.ListAsync(x => x.Country == "BE" && x.LineCount >= 3);
await orders.ListAsync(x => x.ShippingAddress!.City == "Ghent");

One meaning, three front ends

A filter means the same thing whichever front end wrote it - a LINQ expression, a filter string, or a JSON filter (WhereAsync(JsonElement) on IDocumentCollection<T>). A construct the engine cannot translate is refused with a classified error rather than quietly reinterpreted.

An unhandled error has occurred. Reload X

Reconnecting

Restoring the connection to the server...

Still trying

Next attempt in seconds

Connection lost

We could not reach the server.