Skip to content

Announcing inversion queries: Exclusion rules made simple_

Adding five new NOT operators to let you exclude what you don’t need while keeping queries efficient.

5 min readUpdated Jun 29, 2026

When you need to exclude certain records, the usual approach is to fetch a broad set of rows, sometimes even the entire table, and then filter them in your application code.

It works, but it also means you are moving more data across the network than necessary, increasing payload sizes, and adding extra logic to your client. In smaller projects this might not be noticeable, but as your datasets grow, it quickly becomes inefficient.

That changes today.

We’re introducing inversion Queries: A new set of NOT operators that let you filter by exclusion directly in your Appwrite queries.

Excluding data just got easier

Exclusion rules come in many forms. Sometimes you need to ignore rows that contain a specific keyword, sometimes you want values that fall outside a numeric range, and other times you need to filter out records based on prefixes or suffixes. These are standard requirements, but they often require extra application-side filtering after fetching results.

With inversion queries, you can express these cases directly in your database calls. The new set of NOT operators gives you a way to describe “everything except” conditions without leaving the query itself.

They include:

  • notContains: Find rows where the column does not contain the given substring
  • notSearch: Find rows where the column does not match the search query
  • notBetween: Find rows where the column is not between two given values
  • notStartsWith: Find rows where the column does not start with the given value
  • notEndsWith: Find rows where the column does not end with the given value

Why does this matter?

By moving negative filters into the query engine itself, you gain:

  • Efficiency: Smaller result sets, fewer wasted reads.
  • Cleaner code: Exclusion logic lives in the query, not your app layer.
  • Flexibility: Easy to add “everything except…” rules without restructuring queries.
  • Composability: Combine not* operators with other filters for precise control.
  • Index-awareness: These operators use the same indexes as their positive counterparts, though keep in mind that NOT conditions can sometimes be less selective.

Practical use cases

Inversion queries open the door to workflows like:

  • Moderation pipelines: Block banned keywords at the query level.
  • AB testing: Exclude users already bucketed into an experiment.
  • Search filters: Hide categories or tags from results without post-filtering.
  • Data hygiene: Skip over ranges of test accounts or synthetic data.
  • Compliance: Avoid restricted or flagged records directly in queries.

Get started

Inversion queries are available now in Appwrite Cloud and Self-Hosted.

Next time you find yourself writing “fetch everything, then filter out X,” let the database do the heavy lifting. Your code stays lean, your queries stay efficient, and your apps stay faster.

More resources

Read next

Introducing Appwrite Explorer

Eldad Fux

Appwrite Explorer brings the Appwrite REST API into the Console. Browse every endpoint, build requests with guided forms, send live calls against your project, and inspect responses without leaving the browser.

8 min read

Introducing Appwrite Terminal

Eldad Fux

Appwrite Terminal runs the Appwrite CLI directly inside the Console. Your session and project context are preconfigured, with keyboard-first controls and multi-tab workflows, so you can inspect resources without leaving the project.

7 min read

Ready to build?_