Reputation: 1573
I am trying to implement single query with a where clause and select columns:
Main Query in SQL form:
SELECT name from users WHERE flag = 1;
Now what I have tried so far is:
userRepository.find({
where: {
flag: 1
},
select: {
name: true
}
})
My query works fine if I don't add select
option, but with select provided it gives me error.
Any idea what I am doing wrong here?
Upvotes: -1
Views: 53
Reputation: 51
Try to select like this
userRepository.find({
where: {
flag: 1
},
select: ['name','id']
})
Upvotes: 1