首页 > 解决方案 > 如果我们使用猫鼬,我们应该在nestJS中使用没有typeorm的实体吗

问题描述

所以,我没有使用 TypeOrm 而是使用 mongoose 用于 mongodb。我创建的接口对使用 Pipes 没有任何好处,因为接口是 typescript 的行为,而不是 Javascript 的行为。

我有架构和文档,但这也没有涉及很多函数参数。
我收到类似的错误

'UserDocument' only refers to a type, but is being used as a value here

(上面的 UserDocument 是在架构文件中创建的export type UserDocument = User & Document;

如果我们使用猫鼬 ORM 并且我们制作的文档(使用export type UserDocument = User & Document;或通过制作接口)不适用于 NestJS 中的大多数功能,那么好的做法是什么。

标签: typescriptmongoosenestjsnestjs-mongoose

解决方案


推荐阅读