prorm API Reference
    Preparing search index...

    Function jsonContains

    • Helper to create JSON contains condition Checks if JSON column contains a specific value or object

      Parameters

      • column: string
      • value: any

      Returns Record<string, any>

      // Find users where preferences contains { theme: 'dark' }
      User.findAll({ where: { preferences: { [Op.jsonContains]: { theme: 'dark' } } } })
      // SQL (PostgreSQL): WHERE preferences @> '{"theme":"dark"}'
      // SQL (MySQL): WHERE JSON_CONTAINS(preferences, '{"theme":"dark"}')

      // Check if JSON array contains a value
      User.findAll({ where: { tags: { [Op.jsonContains]: 'admin' } } })