D. this.userRepository.createQueryBuilder('user')
.where('user.age > :age OR user.role = :role', { age: 30 })
.getMany();
Solution
Step 1: Understand the OR condition
We want users older than 30 OR with role 'admin', so we use where and orWhere.
Step 2: Check parameter usage
this.userRepository.createQueryBuilder('user')
.where('user.age > :age', { age: 30 })
.orWhere('user.role = :role', { role: 'admin' })
.getMany(); correctly uses where with age and orWhere with role, both with parameters.
Step 3: Identify errors in other options
this.userRepository.createQueryBuilder('user')
.where('user.age > :age AND user.role = :role', { age: 30, role: 'admin' })
.getMany(); uses AND instead of OR. this.userRepository.createQueryBuilder('user')
.where('user.age > 30 OR user.role = admin')
.getMany(); lacks parameter binding. this.userRepository.createQueryBuilder('user')
.where('user.age > :age OR user.role = :role', { age: 30 })
.getMany(); misses role parameter.