ay batch
Bulk-Operationen über mehrere Datensätze — gemacht für Scripts und AI-Agenten. Kompakter als ein Loop um ay get / ay delete / ay update, mit aggregiertem Reporting.
Subcommands
ay batch get <collection> <ids>
Multi-GET via kommaseparierte IDs.
ay batch get contacts id1,id2,id3
echo "id1,id2,id3" | ay batch get contacts --stdin
ay batch delete <collection> <ids> (Alias: rm)
Multi-DELETE. --force empfohlen für non-TTY.
ay batch delete contacts id1,id2,id3 --force
echo "id1,id2" | ay batch delete contacts --stdin --force
ay batch update <collection> <ids> (analog)
Multi-UPDATE mit --set oder --body.
ay batch update tasks id1,id2,id3 --set status=archived --force
Flags (alle Subcommands)
| Flag | Zweck |
|---|---|
--stdin |
IDs aus stdin lesen (zeilen- oder kommagetrennt) |
--force |
Confirmation überspringen |
Pipeline-Pattern
# Alle archivierten Tasks älter als 30 Tage löschen
ay search tasks --filter "status=archived,createdAt<2026-03-26" -i _id -m \
| ay batch delete tasks --stdin --force
# Alle inaktiven Consumers reaktivieren
ay list consumers --filter '{"active":false}' --fields '{"_id":1}' -m \
| ay batch update consumers --stdin --set active=true --force
Output
Sequenzielle Ausführung mit Status-Spinner:
Fetched 18/20 entries (2 errors)
Bei mindestens einem Fehler → Exit 1.