Skip to Content
Lazy Appwrite v1.1.0 is out! 🎉
DocsAdvancedQueries

Queries

Lazy Appwrite ships with a smarter, cleaner Query Engine. You can now write queries using a simple object syntax — no need to import Query or manually build strings.

This feature aims to improve DX while staying fully compatible with Appwrite under the hood.


What You Can Do

1. Implicit Equality

If you pass a primitive value, it becomes an equality check.

await Users.list({ age: 25, active: true, });

2. Mongo-Style Operators

For advanced logic, you can specify operators using the $ prefix.

OperatorMaps ToMeaning
$eqQuery.equalEquals
$neQuery.notEqualNot equal
$gtQuery.greaterThanGreater than
$gteQuery.greaterThanEqualGreater than or equal (≥)
$ltQuery.lessThanLess than
$lteQuery.lessThanEqualLess than or equal (≤)
$searchQuery.searchFull-text search
$startsWithQuery.startsWithString prefix
$endsWithQuery.endsWithString suffix
$betweenQuery.betweenRange [min, max]
$inQuery.equal(key, [array])”IN” list
$isNullQuery.isNullField is null
$isNotNullQuery.isNotNullField exists

Examples

// Range await Products.list({ price: { $gte: 100, $lte: 500 }, }); // Search await Posts.list({ title: { $search: "lazy appwrite" }, }); // IN await Users.list({ status: { $in: ["active", "pending"] }, }); // Null await Logs.list({ error_code: { $isNotNull: true }, });

Legacy Syntax (Still Supported)

If you want the raw Appwrite SDK queries, you can still pass an array.

import { Query } from "lazy-appwrite"; await Users.list([Query.equal("role", "admin"), Query.orderDesc("$createdAt")]);

Limitations (Important)

⚠️

Below is what this version does NOT support — don’t attempt it yet.

No $or (Logical OR)

Everything inside the object is combined using AND.

// This works (AND) await Users.list({ age: { $gt: 18 }, active: true }); // This does NOT work (no OR support yet) /* await Users.list({ $or: [{ age: { $gt: 18 } }, { active: true }], }); */

If you must use OR, switch to the legacy array syntax Query.or([...]).

No Deep Nesting

Only one operator level is supported.

// NOT supported /* await Users.list({ meta: { settings: { $eq: true }, }, }); */

Index Rules Still Apply

Appwrite will throw errors for fields without indexes. Lazy Appwrite does not bypass any database restrictions.

// Will fail if no index exists for `price` await Products.list({ price: { $gt: 100 } });
Last updated on