'What is the difference between Query builder, find and findone in typeorm?

I have used a query in typeorm using query builder as:

getManager().CreateQueryBuilder(class_name_from_entity_file, 'xyz').select('column_name').where('active_status=1').execute()

This is giving me proper output but I have been suggested to use 'find' instead. Now I have changed my query to:

getManager().find(class_name_from_entity_file,
{
  select:['column_name'],
  where: {
          active_status: 1
          }
} 

both of these queries are giving me the same output so what is the difference between query builder and find? please tell me about findone too



Solution 1:[1]

I think createQueryBuilder is control data output better than find or findOne. We use leftJoin to handle relations instead pass relation into find. And with createQueryBuilder, we handle groupBy but find is not provide groupBy.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Anh Tran