微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Mikro orm:使用原始查询查找和计数

如何解决Mikro orm:使用原始查询查找和计数

大家好,我正在使用 Mikro ORM,我想向我的存储库的 findAndCount 方法添加原始查询

我有以下实体:

人员:

@Property({ nullable: false })
firstName: string;

@Property({ nullable: false })
lastName: string;

@Property({ nullable: false,default: '' })
email: string;

@property()
deletedAt: string;

所以我想得到所有,其中deletedAt不是NULL,deletedAt有一些价值

到目前为止我有这个,但我不知道如何在我的子句中包含 where deletedAt is not NULL ://

   const options = { offset: 5
            limit: 10,populate: ['company'] }

 return this.findAndCount({},options);

编辑:潜在解决方


发现这个查询也有效,如果有人需要它

return this.findAndCount({ deletedAt: { $ne: null } },options);

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。