Skip to main content
Doubt uses MongoDB as its database, accessed through Prisma v6. The Prisma schema is defined in prisma/schema.prisma.

Connection

The Prisma client is initialized in src/handlers/prisma.js as a singleton. It reads the MongoDB URI from config.handler.mongodb.uri (which resolves to DEV_MONGODB_URI or MONGODB_URI based on the PRODUCTION flag). Connection is established during bot startup if config.handler.mongodb.toggle is true.

Prisma CLI

For Prisma CLI tools (like prisma db push or prisma studio), set the DATABASE_URL environment variable in .env to your MongoDB connection string.
MongoDB does not support migrations (prisma migrate commands will not work).

Models

EcoSchema

Economy accounts — one per user per guild. Collection: ecoschemas Used by: /economy, /bal, /deposit, /withdraw, /beg, /rob

Users

User configuration and badge assignments. Collection: users Used by: /user info, /badge give/take, context menus (info, profile)

Badge

Global badge definitions (not per-guild). Collection: badges Used by: /badge (create/edit/delete/give/take/list), user info displays

Afk

AFK status entries — one per user per guild. Collection: afks Used by: /afk set/remove, AFK check event handler

Xp

Experience points and level data — one per user per guild. Collection: xps Used by: /rank info/reset/set

Welcome

Welcome system configuration — one per guild. Collection: welcomes Used by: Setup wizard (welcomeSSM), guildMemberAdd event

Ticket

Ticket system configuration — one per guild. Collection: tickets Used by: Setup wizard (ticketSSM), ticket menu, ticket modal

GuildSchema

Per-guild settings (currently prefix only). Collection: guildschemas Used by: Prefix command routing, ?prefix set/reset

Chatbot

Chatbot channel configuration — one per guild. Collection: chatbots Used by: Currently imported but not actively used in any command.

JTCSetup

Join-to-Create voice channel configuration — one per guild. JTCChannel (embedded type): Collection: jtcsetups Used by: voiceStateUpdate event handler

Schema Files

The schema files in src/schemas/ are thin re-exports of Prisma model delegates:
This preserves backward-compatible import paths throughout the codebase while using Prisma under the hood.