How-To Guides¶
Practical recipes for specific tasks. Each guide is self-contained — jump to what you need.
Define Models : Models, Maps, fields, defaults, enums, inheritance.
Work with Document IDs : ID types, constraints, auto-generation, manual IDs.
Auto-Timestamps : Automatically set created/updated timestamps on save.
Use TTL Policies : Auto-delete documents after a timestamp with Firestore TTL.
Write, Update, and Delete : Save, create, update, delete, refresh, optimistic locking.
Batch Writes and Transactions : Atomic multi-document writes, save_many/delete_many, transactions.
Filter and Query : Operators, composition, chainable queries, operator reference table.
Use Aliases : When Firestore field names differ from Python attribute names.
Serialize Data
: from_dict, to_dict, testing without a Firestore connection.
Extend Type Validation : Register custom types, type handlers, supported types reference.
Use Async
: AsyncCendry, AsyncQuery, anyio, async iteration.
Test with Emulator : Integration tests with Firestore emulator via testcontainers.
Migrate from Datastore to Native : Step-by-step migration from Firestore Datastore mode to Native mode.