Skip to content

Use this LLM Friendly Docs as an MCP server for Marten.

The search box in the website knows all the secrets—try it!

For any queries, join our Discord Channel to reach us faster.

JasperFx Logo

JasperFx provides formal support for Marten and other JasperFx libraries. Please check our Support Plans for more details.

Searching with Boolean Flags

Linq queries against boolean properties can use shorthand mechanisms in Where() clauses like so:

cs
public async Task query_by_booleans(IDocumentSession session)
{
    // Flag is a boolean property.

    // Where Flag is true
    await session.Query<Target>().Where(x => x.Flag).ToListAsync();
    // or
    await session.Query<Target>().Where(x => x.Flag == true).ToListAsync();

    // Where Flag is false
    await session.Query<Target>().Where(x => !x.Flag).ToListAsync();
    // or
    await session.Query<Target>().Where(x => x.Flag == false).ToListAsync();
}

snippet source | anchor

Released under the MIT License.