Complete the code to create a query builder for the User entity.
const userQuery = dataSource.getRepository(User).[1]();The createQueryBuilder method starts building a query for the User entity.
Complete the code to add a WHERE clause filtering users by age.
const users = await userQuery.where('user.age [1] :age', { age: 18 }).getMany();
The operator >= filters users with age 18 or older.
Fix the error in the code to select only the 'name' and 'email' fields.
const users = await userQuery.select(['user.name', [1]]).getMany();
Fields must be prefixed with the alias 'user.', so 'user.email' is correct.
Fill both blanks to order users by creation date descending and limit results to 5.
const users = await userQuery.orderBy('user.createdAt', [1]).[2](5).getMany();
Use 'DESC' to order descending and take(5) to limit results in NestJS query builder.
Fill all three blanks to build a query that filters active users, selects their id and name, and orders by name ascending.
const users = await userQuery.where('user.isActive = [1]').select(['user.[2]', 'user.[3]']).orderBy('user.name', 'ASC').getMany();
Filter active users with true, select id and name fields, and order by name ascending.