简体   繁体   中英

typeorm generating extra column in select?

why the following typeorm query

const result6 = await getConnection()
        .createQueryBuilder()
        .select('actor.name')
        .from(Actor,'actor')
        .innerJoin('actor.castings','casting')
        .where('casting.movieId = :id',{id:27})
        .getMany();

produces this result:

SELECT "actor"."name" AS "actor_name", "actor"."id" AS "actor_id" 
FROM "actor" "actor" 
 INNER JOIN "casting" "casting" ON "casting"."actorId"="actor"."id" 
WHERE "casting"."movieId" = $1

why actor.id is also selected?

i just done some testing, and i noticed that the id is always included in the queries for some reason, but the returned values don't include it, it only includes what you put on the select.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM