How to perform a like query Typeorm

后端 未结 5 609
北海茫月
北海茫月 2020-12-30 22:40

Hello guys I\'m trying to find all the results that have a in them. I have tried a couple of ways but the problem is nothing works. It just returns an empty array

5条回答
  •  难免孤独
    2020-12-30 23:28

    Correct way is:

     var data = await getRepository(User)
                      .createQueryBuilder("user")
                      .where("user.firstName like :name", { name:`%${firstName}%` })
                      .getMany();
    

提交回复
热议问题