Skip to Content
New to Genbox? Check out our Getting Started guide
Commandsdb sync

gb db sync

Sync database from staging or production to your Genbox.

Synopsis

gb db sync [options]

Description

Copies database contents from a source environment (staging/production) to your Genbox. Useful for testing with real data.

Options

OptionDescription
--source <env>Source environment: staging or production
--include <list>Only sync specific collections
--exclude <list>Exclude specific collections
--name <env>Target Genbox environment
--dry-runShow what would be synced
-y, --yesSkip confirmation

Examples

Sync from Staging

gb db sync --source staging

Sync from Production

gb db sync --source production

Selective Sync

# Only sync specific collections gb db sync --source staging --include users,products,orders # Exclude large collections gb db sync --source staging --exclude logs,analytics,sessions

Preview

gb db sync --source staging --dry-run

Collection Filtering

Include Pattern

# Specific collections --include users,products # Pattern matching --include "user*,product*"

Exclude Pattern

# Exclude logs --exclude logs,audit_logs # Exclude temporary data --exclude "temp*,cache*"

Safety Features

Production Safeguards

When syncing from production:

  • Confirmation required
  • Read-only snapshot used
  • PII masking option available
  • Audit logging
⚠️ Syncing from PRODUCTION This will copy data from production to your Genbox. Production data may contain sensitive information. Type 'yes' to confirm: _

Data Masking

# Mask sensitive fields gb db sync --source production --mask email,phone,ssn

Progress Output

Syncing database from staging... Collections: ✓ users 1,234 documents (2.1 MB) ✓ products 5,678 documents (12.3 MB) ✓ orders 3,456 documents (8.7 MB) ○ bookings syncing... 45% · payments · notifications Progress: 4/6 collections (23.1 MB / 45.2 MB)

Notes

  • Large databases may take several minutes
  • Existing data is replaced (not merged)
  • Indexes are recreated
  • Use --dry-run to preview size

See Also

Last updated on