Campaign

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:

AttributeTypeDescription
_idObjectIdA unique identifier automatically generated by MongoDB
nameStringThe name of the campaign
creationDateStringThe date the campaign was created, in ISO 8601 format
expiryDateStringThe date the campaign will expire, in ISO 8601 format
couponCountStringThe number of coupons generated for the campaign, if applicable
enabledBooleanWhether the campaign is currently enabled or disabled
discountTypeStringThe type of discount offered by the campaign (e.g. 'percent', 'amount', 'free item')
discountNumberThe value of the discount, in the currency specified in the application (e.g. 10% or $5 off)
discountPectNumberThe percentage of the discount, if applicable (e.g. 10% off)
discountItemNumberThe number of items included in the discount, if applicable (e.g. 'buy one, get one free')
freeItemStringThe ID of the free item included in the promotion, if applicable (e.g. '5f7c408cfbc3f64c39a3d23a')
skuIdsArrayAn array of SKUs (stock keeping units) associated with the campaign, if applicable
conditionsArrayAn array of conditions that must be met for the discount to apply, if applicable
redemptionNumberThe maximum number of times the promotion can be redeemed, if applicable
titleStringA title or headline for the campaign
descStringA description of the campaign
formatStringThe 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****"
}