SyncSubscriptionGroup
resource allows you to apply multiple subscriptions to one or more
databases. Subscriptions use Ditto Query Language (DQL) to specify exactly which
documents to sync, helping optimize bandwidth and storage usage.
Basic Configuration
Required Fields
Field | Type | Description |
---|---|---|
resource_type | string | Must be "SyncSubscriptionGroup" |
db_ids | array[string] | List of database IDs (UUIDv4 format) this subscription group applies to (minimum 1) |
subscriptions | array | List of DQL subscriptions to apply (minimum 1) |
Subscription Formats
Each subscription in thesubscriptions
array can be either:
Simple String Query
Query with Arguments
Mixed Format
Complete Examples
Single Database Subscription Group
Multiple Database Subscription Group
Complex Subscription Group
Subscriptions in DittoDatabase Resource
You can also define subscriptions directly within aDittoDatabase
resource configuration:
Best Practices
- Use DQL best practices.
-
Use YAML anchors and aliases to stay DRY and ensure
db_id
s are correct:
-
Group Related Subscriptions: Use
SyncSubscriptionGroup
to logically group related subscriptions that should be applied together. - Minimize Overlap: Avoid overlapping subscriptions that would sync the same data multiple times.
Important Notes
- Subscription Scope: Subscriptions only affect what data is synchronized to this Edge Server instance, not what data exists elsewhere in the mesh.
- Multiple Groups: You can have multiple
SyncSubscriptionGroup
resources for the same database to organize different sync patterns. - Query Validation: Invalid DQL queries will cause the subscription to fail during Edge Server startup.
- Configuration Updates: Changes to subscription configuration require Edge Server restart to take effect.
- Query Arguments: The
args
object supports various data types including strings, numbers, booleans, arrays, and nested objects. - Inline vs Group: You can define subscriptions either directly in a
DittoDatabase
resource or in separateSyncSubscriptionGroup
resources. Use groups when you want to apply the same subscriptions to multiple databases.