Campaign Schema
Data Model
The campaign object is a schema that defines the structure of a document for a campaign in a MongoDB database. The campaign object contains the following fields:
Attribute | Type | Description |
---|---|---|
_id | ObjectId | A unique identifier automatically generated by MongoDB |
name | String | The name of the campaign |
creationDate | String | The date the campaign was created, in ISO 8601 format |
expiryDate | String | The date the campaign will expire, in ISO 8601 format |
couponCount | String | The number of coupons generated for the campaign, if applicable |
enabled | Boolean | Whether the campaign is currently enabled or disabled |
discountType | String | The type of discount offered by the campaign (e.g. 'percent', 'amount', 'free item') |
discount | Number | The value of the discount, in the currency specified in the application (e.g. 10% or $5 off) |
discountPect | Number | The percentage of the discount, if applicable (e.g. 10% off) |
discountItem | Number | The number of items included in the discount, if applicable (e.g. 'buy one, get one free') |
freeItem | String | The ID of the free item included in the promotion, if applicable (e.g. '5f7c408cfbc3f64c39a3d23a') |
skuIds | Array | An array of SKUs (stock keeping units) associated with the campaign, if applicable |
conditions | Array | An array of conditions that must be met for the discount to apply, if applicable |
redemption | Number | The maximum number of times the promotion can be redeemed, if applicable |
title | String | A title or headline for the campaign |
desc | String | A description of the campaign |
format | String | The format of the promotion or coupon (e.g. 'discount code', 'printable coupon', 'online offer'), if applicable |
Overall, the campaign object is a flexible and customizable schema that can be used to store and manage various types of campaigns in a MongoDB database.
Example
{
name: "Summer Sale",
creationDate: "2023-05-01",
expiryDate: "2023-06-30",
couponCount: 1000,
enabled: true,
discountType: "Percentage",
discount: 10,
discountPect: 0,
discountItem: 0,
freeItem: "",
skuIds: ["SKU1", "SKU2", "SKU3"],
conditions: [
{
type: "income",
value: 40000,
operator: "greater_than_or_equal_to"
},
{
type: "recency",
value: 60,
operator: "less_than_or_equal_to"
}
],
redemption: 0,
title: "Get 10% off on your purchase",
desc: "Use code SUMMERSALE10 to get 10% off on your purchase.",
format: "SUMMERSALE****"
}