0

I applied hidden property on password:

 @Column({nullable: true, select: false})
 password: string;

Doing the login i need the password filed. So according to he documentation i can select this hidden value by using:

const qb = getConnection().createQueryBuilder()
const user = await qb
  .select("password", "password")
  .from(User, 'user')
  .where("password = :password", {
    password: password
  })
  .addSelect('password', 'password')
  .getOne()

Doing this i get undefined and the password property anyway remains hidden.
How to get hidden values in my situation?

1 Answer 1

1

According to the documentation you can select hidden value by using

.addSelect('user.password')

You have .addSelect('password', 'password') which will not work. Do not alias the columns for hidden columns. (Probably a bug in TypeOrm).

This will also work

   .select('user.password')

You don't need both select and addSelect for the same columns, the addSelect does nothing since the columns are already selected.

Sign up to request clarification or add additional context in comments.

1 Comment

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.