MongoDB Data Storage Structure
This document describes exactly what data is stored in MongoDB when you use the Image Colorization API.
Database: colorization_db
Collection 1: api_calls
Stores every API endpoint call with timestamp.
Data Structure:
{
"_id": ObjectId("..."), // MongoDB auto-generated ID
"endpoint": "/health", // API endpoint path
"method": "GET", // HTTP method (GET, POST)
"status_code": 200, // HTTP status code
"timestamp": ISODate("2025-11-27T04:22:27.823Z"), // UTC timestamp when API was called
"request_data": { // Request parameters/data
"filename": "Descratch.png",
"content_type": "image/png"
},
"response_data": { // Response data returned
"status": "healthy",
"model_loaded": true
},
"error": null, // Error message if any
"user_id": null, // User ID if authenticated
"ip_address": "127.0.0.1" // Client IP address
}
Example for /upload endpoint:
{
"endpoint": "/upload",
"method": "POST",
"status_code": 200,
"timestamp": ISODate("2025-11-27T10:00:00.000Z"),
"request_data": {
"filename": "Descratch.png",
"content_type": "image/png"
},
"response_data": {
"success": true,
"image_id": "abc123-def456-ghi789",
"image_url": "https://.../uploads/abc123.jpg",
"filename": "abc123.jpg"
},
"error": null,
"user_id": null,
"ip_address": "192.168.1.100"
}
Example for /colorize endpoint:
{
"endpoint": "/colorize",
"method": "POST",
"status_code": 200,
"timestamp": ISODate("2025-11-27T10:00:05.000Z"),
"request_data": {
"filename": "Descratch.png",
"content_type": "image/png",
"positive_prompt": "colorize this image",
"negative_prompt": "low quality",
"seed": 123,
"num_inference_steps": 8
},
"response_data": {
"success": true,
"result_id": "xyz789-abc123-def456",
"download_url": "https://.../results/xyz789.png",
"api_download_url": "https://.../download/xyz789",
"filename": "xyz789.png",
"caption": "colorized image"
},
"error": null,
"user_id": null,
"ip_address": "192.168.1.100"
}
Collection 2: image_uploads
Stores information about every image upload.
Data Structure:
{
"_id": ObjectId("..."), // MongoDB auto-generated ID
"image_id": "abc123-def456-ghi789", // Unique image identifier (UUID)
"filename": "Descratch.png", // Original filename
"file_size": 245678, // File size in bytes
"content_type": "image/png", // MIME type
"uploaded_at": ISODate("2025-11-27T10:00:00.000Z"), // UTC timestamp
"user_id": null, // User ID if authenticated
"ip_address": "192.168.1.100" // Client IP address
}
Example with Descratch.png:
{
"image_id": "abc123-def456-ghi789",
"filename": "Descratch.png",
"file_size": 245678,
"content_type": "image/png",
"uploaded_at": ISODate("2025-11-27T10:00:00.000Z"),
"user_id": null,
"ip_address": "192.168.1.100"
}
Collection 3: colorizations
Stores information about every colorization request.
Data Structure:
{
"_id": ObjectId("..."), // MongoDB auto-generated ID
"result_id": "xyz789-abc123-def456", // Unique result identifier (UUID)
"image_id": "abc123-def456-ghi789", // Original image identifier
"prompt": "colorize this image", // Text prompt used (if any)
"model_type": "sdxl", // Model type: "fastai", "pytorch", "sdxl", "gan"
"processing_time": 3.45, // Time taken to process in seconds
"created_at": ISODate("2025-11-27T10:00:05.000Z"), // UTC timestamp
"user_id": null, // User ID if authenticated
"ip_address": "192.168.1.100" // Client IP address
}
Example with Descratch.png:
{
"result_id": "xyz789-abc123-def456",
"image_id": "abc123-def456-ghi789",
"prompt": "colorize this image with vibrant natural colors",
"model_type": "sdxl",
"processing_time": 3.45,
"created_at": ISODate("2025-11-27T10:00:05.000Z"),
"user_id": null,
"ip_address": "192.168.1.100"
}
What Gets Stored When You Use Descratch.png
When you upload and colorize Descratch.png, the following data will be stored:
API Call Logs (
api_callscollection):/health- Health check call/upload- Image upload call with request/response data/colorize- Colorization call with processing parameters/download- Download result call (if you download the result)/results- Public result access call (if accessed)
Image Upload Record (
image_uploadscollection):- Image ID (UUID)
- Filename: "Descratch.png"
- File size in bytes
- Content type: "image/png"
- Upload timestamp
- IP address
Colorization Record (
colorizationscollection):- Result ID (UUID)
- Image ID reference
- Model type used
- Processing time
- Creation timestamp
- IP address
All Data Includes Timestamps
Every record includes a UTC timestamp:
api_calls.timestamp- When the API endpoint was calledimage_uploads.uploaded_at- When the image was uploadedcolorizations.created_at- When the colorization was created
Querying the Data
You can query MongoDB to:
- Find all API calls in the last 24 hours
- Track which images were uploaded
- Monitor colorization processing times
- Analyze API usage patterns
- Track errors and status codes