Managing ordered data can often be complex and error-prone, especially when it requires manual counters or timestamp-based sorting, which can introduce inconsistencies and unpredictability.
To tackle this issue, we're introducing Auto-increment support.
This new feature automatically handles a $sequence column within your documents, incrementing reliably with each new insertion. This ensures your data remains ordered and clear without additional manual overhead.
Automatic, predictable ordering
Previously, maintaining consistent insertion order and generating numeric identifiers required either manual increments, complex logic, or dependence on timestamps, which weren't always accurate or reliable. Appwrite’s new Auto-increment support feature solves these issues seamlessly, providing a built-in numeric identifier that increases predictably with every new document added.
Whether you're creating paginated data sets, managing invoice numbers, logging activities, or building real-time feeds, Appwrite's Auto-increment support feature offers effortless numeric sequencing. This means less manual work, fewer bugs, and significantly improved reliability.
Tailored for backend systems
Auto-increment support is engineered explicitly for backend tasks that require consistent, deterministic identifiers such as sorting, pagination, and specialized sequencing. It's particularly suited to applications demanding precision, such as fintech solutions, logistics and shipping systems, invoicing and billing platforms, and comprehensive reporting and analytics tools.
Integrating Auto-increment support into your Appwrite Databases makes your backend development simpler and more intuitive.
Key advantages at a glance:
- Automatically managed: No need to write custom logic or manually increment counters.
- Strictly increasing: Each new entry receives a reliably sequential numeric identifier.
- Fully indexed: Optimized for performance, allowing fast sorting and efficient querying.
- Read-only protection: Safeguards against accidental modifications or tampering, preserving data integrity.
How it works
For numeric ordering based on insertion order, you can use the $sequence field, which Appwrite automatically adds to all documents. This field increments with each new insert.
import { Client, Databases, Query } from "appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1')
.setProject('<PROJECT_ID>');
const databases = new Databases(client);
databases.listDocuments({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
queries: [
Query.orderAsc('$sequence'),
]
});
Auto-increment support is available on both Appwrite Cloud and self-hosted installations and can smoothly integrate into your existing workflows.



