TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Priyanshu471/ad-management/llms.txt
Use this file to discover all available pages before exploring further.
Campaign model represents an advertising campaign created by a user in the Ad Management System. Defined in models/campaign.ts, it stores all campaign metadata — from creative details like title and description to performance metrics like impressions, clicks, and click-through rate. Each campaign holds a required reference to the User who owns it, establishing a many-to-one relationship between campaigns and advertisers.
Schema
models/campaign.ts
Fields
Auto-generated unique identifier assigned by MongoDB on document creation.
The campaign name displayed across the advertiser and admin dashboards.
A short description summarising the campaign’s purpose or creative direction.
The campaign’s marketing objective. See the Campaign Objectives section for all nine accepted values.
The current lifecycle state of the campaign. Defaults to
"Active" on creation. The schema accepts any string — no enum constraint is applied at the database layer.Optional. The total number of times the campaign’s ad has been displayed.
Optional. The total number of clicks the campaign’s ad has received.
Optional. The click-through rate, stored as a string (e.g.
"5" represents 5%). See the note below on string storage.The allocated budget for the campaign (e.g.
"50000" or "10,000"). See the note below on string storage.The intended run length of the campaign (e.g.
"30 days").A reference to the
User document that owns this campaign. Populated via ref: "User".Timestamp automatically set by Mongoose when the document is first created.
Timestamp automatically updated by Mongoose whenever the document is modified.
Sample Document
Campaign Objectives
Theobjective field accepts one of nine values sourced from the application’s campaignObjective array in lib/data.ts. These represent standard digital advertising goals:
String Fields
Both
budget and ctr are stored as String rather than Number in MongoDB. This is intentional — string storage allows flexible display formatting such as comma-separated budget values (e.g. "10,000") and percentage representations for CTR (e.g. "5" for 5%), without requiring transformation at the database layer. Parse these fields to a number only when arithmetic operations (such as aggregation or comparison) are needed at the application level.