#TypeOrm gives Null back

3 messages · Page 1 of 1 (latest)

fallow mauve
#
async findOneById(id: number): Promise<User> {
        return await this.userRepository.findOne({
            where: {
                id: id,
            }
        })
    }
``` why we get back `null` i search by id the user, id exists and yeah.
#

I use typeorm 0.3

patent jay
#

If the ​findOneById function returns null, it means that no record was found in the database that matched the given id.