小编Roh*_*pta的帖子

如何使用 TypeORM 中的 find-options API 在 where 对象中使用“OR”操作进行查询

我想在我的 repo 中找到结果,其中 firstname 类似于 'john' OR lastname 类似于 'doe' 但 findOptions where 子句将其视为 AND。

我试过的:

let results = await userRepo.find({
  where : {
    firstname : Like('%John%'),
    lastname : Like('%Doe%'),
  }
});
Run Code Online (Sandbox Code Playgroud)

我对此的期望:

let results = await userRepo.find({
  where : {
    firstname : Like('%John%'),
    lastname : Or(Like('%Doe%')),
  }
});
Run Code Online (Sandbox Code Playgroud)

关于如何在 where 对象中使用OR 的任何帮助?

typeorm

0
推荐指数
1
解决办法
6528
查看次数

标签 统计

typeorm ×1