prorm API Reference
    Preparing search index...

    Function jsonHasKey

    • Helper to create JSON has key condition Checks if JSON column has a specific key

      Parameters

      • column: string
      • key: string

      Returns Record<string, any>

      // Find users where data column has 'role' key
      User.findAll({ where: { data: { [Op.jsonHasKey]: 'role' } } })
      // SQL (PostgreSQL): WHERE data ? 'role'
      // SQL (MySQL): WHERE JSON_CONTAINS_PATH(data, 'one', '$.role')

      // Nested key
      User.findAll({ where: { data: { [Op.jsonHasKey]: 'settings.theme' } } })