This directory contains sample JavaScript files that initialize a DocumentDB instance with demo data. The data represents a simple e-commerce application with users, products, orders, and analytics.
Contains sample user accounts with the following structure:
- User profiles with personal information
- Preferences and settings
- Tags for categorization
- Indexed on email, username, city, and tags
Contains sample product catalog with:
- Electronics, lifestyle, food, and photography items
- Detailed specifications and pricing
- Ratings and reviews data
- Indexed on category, brand, price, tags, and SKU
Contains sample order data including:
- Order details and customer information
- Line items with product references
- Order status tracking
- Shipping and payment information
- Indexed on userId, orderNumber, status, orderDate, and customer email
Contains sample analytics and reporting data:
- Monthly summary metrics
- Daily user activity logs
- Product performance data
- Fields that can be queried with aggregation pipelines after startup
All sample data is inserted into the sampledb database to keep it separate from any existing data.
These files are executed when the DocumentDB container starts only if built-in sample data is explicitly enabled with --init-data true or INIT_DATA=true. Seeding runs once per data volume (on a fresh volume) and is skipped on subsequent restarts; the scripts are idempotent, so a re-run is a no-op. To seed again, start with a fresh data volume. They can also be run manually using mongosh:
mongosh localhost:10260 -u username -p mypassword --authenticationMechanism SCRAM-SHA-256 --tls --tlsAllowInvalidCertificates --file 01-users.js- 5 users with diverse profiles and preferences
- 5 products across different categories
- 4 orders in various stages (pending, processing, shipped, delivered)
- 2 analytics records with sample metrics and user activity
This sample data provides a foundation for testing queries, exploring DocumentDB features, and building applications.