add note about selecing specific columns

This commit is contained in:
Johann150 2022-09-11 22:01:42 +02:00
parent 515957ee74
commit 09818f425c
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1

View file

@ -270,6 +270,12 @@ const users = userIds.length > 0 ? await Users.find({
}) : [];
```
### typeorm: selecting only specific columns
If you select specific columns of a table only, you will probably not be able to use the usual `getOne`, `getMany` etc.
Instead you might want to try using `getRawOne` and `getRawMany`.
For that, you may also want to add aliases to the columns you select, which can be done using the second parameter of `select` or `addSelect`.
### Array indexing in SQL
PostgreSQL array indices **start at 1**.