Skip to content

MongoDB Collections Catalog

Database: uengage (see connection facts). Models live under models/*.js as Mongoose schemas. Where a schema declares an explicit collection: option, that is the on-disk name; otherwise Mongoose lowercases/pluralizes the model name.

Validation legend: ✅ verified in code · 💻 code-only · ⚠️ tech debt/risk · ⚰️ dead

⚠️ Blanket caveat: unless a field row says Indexed, the collection defines no indexes in its model. Only order_dump.order_id and sms_summary.mobile_number are indexed. All other filters (including on parent_business_id/business_id) are collection scans — see Optimization notes.

Domain map

Domain Collections
Queues & buffers crm_queue, order_dump, customer_injestion_dump, fcm_injestion_dump, nps_comm_request, daily_jobs, check_in
Campaigns & comms campaign_mis, campaign_journey, campaign_type, campaign_tags, sms_summary, email_jobs, external_link_stats, unsubscribed_campaigns, fcmjunk, wallet_transaction
Feedback & analytics rating_review, mis_rating, nps_config, dashboard_mis, business_aggreator
Config & master business_config, Parent_Id, salon_service, dashboard_module
Ops & utility customer_checkin, cron_status, checkin_cron_status, testmodel

1. Queues & buffers

High-write staging collections drained by crons. ⚠️ None have TTL — growth is unbounded (see Queues).

crm_queuemodels/crm_queue.js

Purpose: the central ingestion seam between the serverless tier and the monolith. Inbound orders/events land here; crons drain status:0. See High-Level Architecture §6.

Field Type Notes
source Number event source identifier (e.g. 6 = a specific POS)
data Mixed full event/order payload (flexible)
insertedAt String insertion timestamp
status Number 0 = pending, processed = drained

Indexes: none ⚠️ (dequeue on {status, source} scans). Used by: orders-consumer λ (writer), ingestion crons (reader). Recent fix removed duplicate source:6 entries — see commit history and Technical Debt.

order_dumpmodels/orders_dump.js

Purpose: order ingestion buffer — raw orders from POS/aggregators pending processing.

Field Type Notes
order_id String Indexed — unique order identifier
mobile_number String customer phone (10-digit)
order_type String channel (POS, Zomato, Swiggy)
store_details String outlet identifier
amount Number order total (INR)
invoiced_at Date invoice timestamp
payment_mode String cash / card / wallet
source String data source system

Indexes: order_id. Used by: order ingestion pipeline, daily MIS aggregation.

customer_injestion_dumpmodels/customer_injestion_dump.js

Purpose: raw customer staging from integrations, awaiting ETL/enrichment.

Field Type Notes
data Mixed raw customer payload
processed Boolean default false

Indexes: none ⚠️. Used by: customer ETL, segmentation.

fcm_injestion_dumpmodels/fcm_injestion_dump.js

Purpose: Firebase Cloud Messaging token ingestion buffer.

Field Type Notes
data Mixed FCM token payload
processed Boolean default false

Indexes: none ⚠️. Used by: push device registration / token refresh.

nps_comm_requestmodels/nps_comm_request.js

Purpose: NPS survey delivery queue — pending survey sends.

Field Type Notes
businnesId String ⚠️ child business ID (typo preserved in code)
parentBusinessId String parent org
orderId Number order reference
source String order source
customer_name String first name
emailId String email
mobileNo String 10-digit mobile
processed Number 0 pending / 1 sent / 2 failed
processTime Date processing timestamp
insertedAt Date queue entry timestamp

Indexes: none ⚠️. Used by: NPS engine (see Feedback).

daily_jobsmodels/daily_jobs.js

Purpose: daily scheduled job queue — recurring campaign executions.

Field Type Notes
campaign_id String campaign ID
execution_time String HH:mm
status Number 0 pending / 1 done / 2 failed
parent_business_id String parent org
child_business_id String child org
is_parent Boolean scope flag
rules Mixed execution rules & conditions

Indexes: none ⚠️. Used by: cron orchestration, recurring campaigns.

check_inmodels/check_in.js

Purpose: raw check-in event buffer (unparsed venue entry/exit logs). Processed form → customer_checkin.

Field Type Notes
source String check-in source
data Mixed event payload
insertedAt String timestamp
status Number processing status

Indexes: none ⚠️. Used by: check-in ETL (checkin_cron_status).


2. Campaigns & communication

campaign_mismodels/campaign_mis.js

Purpose: cumulative campaign delivery stats per parent/child business. Denormalized rollup for dashboards.

Field Type Notes
parent_business_id String default ""
business_id String default ""
is_parent Boolean scope flag
created_at String record date (default "")
total_campaigns_sent Number cumulative
total_push_noti_campaigns Number push campaigns
total_sms_campaigns Number SMS campaigns
total_sms_sent Number SMS messages sent
total_sms_price Number SMS cost accrual
total_android_notifications Number Android delivered
total_ios_notifications Number iOS delivered
total_web_push_campaigns Number web push campaigns
total_web_push_notifications Number web push delivered

Indexes: none ⚠️. Used by: dashboard MIS generation, campaign analytics. See Common-Queries.

campaign_journeymodels/campaign_journey.js

Purpose: multi-step automation journeys — rules and data pipelines.

Field Type Notes
parent_business_id String parent org
child_business_id String child org
is_parent Boolean scope flag
campaign_type_id ObjectId campaign_type
run_status Boolean default true
campaign_data Mixed journey rules/conditions

Indexes: none ⚠️. Used by: automated campaign execution.

campaign_typemodels/campaign_types.js

Purpose: master catalog of campaign types and their form field schemas.

Field Type Notes
title String type name
description String description
campaign_type String category (SMS/email/push)
icon_url String UI icon
execution_type String enum '1' realtime / '2' scheduled
fields Array dynamic form field schema

Indexes: none. Used by: campaign creation UI.

campaign_tagsmodels/campaign_tags.js

Purpose: organizational tags/labels for campaigns.

Field Type Notes
tag_name String label
businessId String child business
parentBusinessId String parent org
createdBy String user
insertedAt String created timestamp
status Number 1 active / 0 archived

Indexes: none. Used by: campaign organization/filtering (added recently — see commit 56417188).

sms_summarymodels/sms_summary.js

Purpose: per-SMS delivery log by campaign & customer.

Field Type Notes
campaign_id String campaign ID
mobile_number String Indexed — 10-digit phone
status Number 0 queued / 1 delivered / 2 failed
delivered_at String delivery timestamp
inserted_date String queued timestamp

Indexes: mobile_number. Used by: SMS delivery tracking, CLTV analysis, DND enforcement.

email_jobsmodels/email_jobs.js

Purpose: per-recipient email delivery/engagement tracking.

Field Type Notes
campaign_id String campaign ID
customer_id String customer ID
customer_email String email
delivered Boolean default false
email_opened Boolean default false
email_bounced Boolean default false
created_at / updated_at String timestamps
processed_status Number processing state
email_open_url String open-tracking URL
from String sender address

Indexes: none ⚠️. Used by: email delivery/engagement metrics.

Purpose: campaign link click-through tracking.

Field Type Notes
campaign_id ObjectId → campaign
customer_id ObjectId → customer
link_opened Boolean default false
opened_at String click timestamp

Indexes: none. Used by: engagement analytics.

unsubscribed_campaignsmodels/unsubscribed_campaigns.js

Purpose: per-campaign opt-out log for compliance/segmentation filtering.

Field Type Notes
campaign_id ObjectId → campaign
customers_id ObjectId → customer

Indexes: none. Used by: unsubscribe compliance, audience filtering.

fcmjunkmodels/notiJunk.js

Purpose: FCM batch processing log — push send batches + Firebase responses/errors (retry/debug).

Field Type Notes
os String iOS / Android
tokens_batch Number batch size
tokens_array Array device tokens in batch
output Mixed Firebase API response
error Mixed error details
mobile_numbers Array associated phones (default [])
campaign_id ObjectId → campaign
parent_business_id String default ""
status Number default 0

Indexes: none ⚠️. Used by: push delivery, debugging, retry logic.

wallet_transactionmodels/wallet_transactions.js

Purpose: business-level wallet ledger — credits/debits for campaign spend (not customer loyalty; that's MySQL wallet_history).

Field Type Notes
transaction_order_id String external order/campaign ref
payment_id String gateway txn ID
transaction_type String enum 'credit' / 'debit'
amount Number INR
description String reason
updated_by String user ID
inserted_date String timestamp
parent_business_id String parent org
child_business_id String child org
campaign_id String campaign ref (if debit)
invoice_generated Boolean default false
invoice_url String default ''
sms_count Number default 0
per_sms_price Number default 0
total_sms_amount Number default 0

Indexes: none ⚠️. Used by: billing, wallet reconciliation, cost tracking. Balance snapshot lives in business_config.wallet_balance.


3. Feedback & analytics

rating_reviewmodels/ratings_reviews.js

Purpose: customer feedback & ratings — post-purchase collection.

Field Type Notes
business_id String child business
parent_business_id String parent org
mobile_number String customer phone
order_id String order ref
rating Number star rating
rating_comments String feedback text
inserted_at Date submission timestamp
source String SMS / app / email
questions Array structured Q&A (default [])
other_params Mixed extra fields
gender String default ''

Indexes: none ⚠️. Used by: NPS/sentiment, quality metrics. (Model name rating_review.)

mis_ratingmodels/rating_mis.js

Purpose: aggregated rating rollup (daily/hourly).

Field Type Notes
inserted_at String period id (YYYY-MM-DD HH🇲🇲ss)
business_id String child business
parent_business_id String parent org
ratings_done Number count submitted
avg_rating Number average stars

Indexes: none ⚠️. Used by: rating trend dashboards.

nps_configmodels/nps_config.js

Purpose: NPS survey configuration per parent org.

Field Type Notes
ans_validty Number response validity (days)
parentBusinessId Number ⚠️ Number (String elsewhere)
request_mode String SMS / email / push
request_trigger_on String trigger event
request_trigger_interval Number delay (minutes)
status Number 1 = active

Indexes: none. Used by: NPS engine (feeds nps_comm_request).

dashboard_mismodels/dashboardMIS.js

Purpose: comprehensive daily MIS — all KPIs per business-day (orders by channel, revenue, new customers, footfall, salon/spa service breakdown, valid/invalid numbers). ~40 numeric fields, all default 0.

Field (representative) Type Notes
created_at String report date (YYYY-MM-DD)
business_id Number ⚠️ Number child business
parent_business_id Number ⚠️ Number parent org
total_order_count / total_order_amount Number orders / value
total_prepaid_* / total_cod_* Number prepaid vs COD split
total_uen_* / total_swig_* / total_zom_* / total_pos_* Number per-channel count & amount
new_customer_count Number first-time customers
check_in_count Number footfall
*_service_count / *_service_amount Number hair/beauty/nail/spa/makeup/other
total_product_count / total_product_amount Number product sales
valid_numbers / invalid_numbers Number phone quality

Indexes: none ⚠️. Used by: BI dashboards, reporting, trend analysis. Full field list in models/dashboardMIS.js.

business_aggreatormodels/buisness_aggregator.js

Purpose: customer cohort aggregates — counts by lifecycle segment (RFM-adjacent). ⚠️ collection/model name is misspelled (aggreator / buisness).

Field Type Notes
businessId String child business
parent_business_id String parent org
is_parent Boolean scope flag
active_user Number recently active
last_acquisition Number days since last new customer
lost_users Number churned
totalUser Number total unique
customers_with_orders_lifetime Number ever ordered
customers_with_no_orders_lifetime Number registered, no purchase
new_customers_ordered / new_customers_not_ordered Number new-cohort split

Indexes: none ⚠️. Used by: segmentation, cohort analysis, RFM counts (see Common-Queries).


4. Config & master

business_configmodels/business_campaigns_config.js

Purpose: per-business campaign + wallet configuration (costs, gateway creds, balance snapshot, alert thresholds). The most-read config collection — hit on every campaign send.

Field (representative) Type Notes
parent_business_id / child_business_id String tenant keys
is_parent Boolean scope flag
name String display name
sms_cost / email_cost / push_noti_cost Number per-message rates
sms_config Array SMS gateway config/creds
active_status Boolean default true
locality / city / state String location
crm_token String CRM API token
fcm_key String FCM key
wallet_balance / last_wallet_balance Number credit balance snapshot
wallet_balance_updated_on String last update
blacklist_segments Array excluded segments (DND)
allow_push_notification Boolean push enabled
default_numbers String sender IDs
dashboard_fields Array dashboard widget config
is_premium Boolean tier flag
last_campaign_sent / last_sms_campaign_sent / last_push_campaign_sent String timestamps
wallet_trigger / amount_trigger / frequency Number low-balance alert thresholds
wallet_email String alert recipient

Indexes: none ⚠️. Used by: processLibrary, balance checks, cost calculations. Note: architecture doc references this as business_configs — the model name is business_config; verify collection option in code if querying the raw driver.

Parent_Idmodels/parent_business.js

Purpose: parent business status registry.

Field Type Notes
parent_business_id Number ⚠️ Number parent org
business_status Number 1 active / 0 inactive

Indexes: none. Used by: business status checks. (Model name Parent_Id.)

salon_servicemodels/salon_services.js

Purpose: salon/spa service master (drives dashboard_mis service breakdown).

Field Type Notes
display_name String UI name
service_id String code (e.g. HAIRCUT)
service_value String category (e.g. Hair)

Indexes: none. Used by: service segmentation, revenue breakdown.

dashboard_modulemodels/dashboard_modules.js

Purpose: dashboard widget registry.

Field Type Notes
display_name String widget title
value String widget type/code

Indexes: none. Used by: dashboard customization UI.


5. Ops & utility

customer_checkinmodels/customer_check_in.js

Purpose: processed check-in records (parsed from check_in).

Field Type Notes
parent_business_id String parent org
child_business_id String venue
mobile_number String 10-digit phone
pax Number party size
checkin_time String timestamp

Indexes: none ⚠️ (footfall lookups by mobile_number/checkin_time scan). Used by: footfall segmentation, location analytics.

cron_statusmodels/cron_stats.js

Purpose: generic cron execution log.

Field Type Notes
start_time / end_time String run window
cron_data String job name
status Boolean completion (default false)
batch Number batch iteration

Indexes: none. Used by: job scheduling, batch monitoring. See Queues.

checkin_cron_statusmodels/checkin_cron_status.js

Purpose: check-in pipeline job log (same shape as cron_status).

Field Type Notes
start_time / end_time String run window
cron_data String job name
status Boolean default false
batch Number batch iteration

Indexes: none. Used by: check-in ETL monitoring.

testmodelmodels/testmodel.js ⚰️

Purpose: dev/sandbox test data. Not production. Candidate for removal.

Field Type Notes
data Mixed arbitrary payload