【发布时间】:2021-06-17 20:49:31
【问题描述】:
我正在这样做
import { CreateQuery, FilterQuery, QueryFindBaseOptions } from 'mongoose';
我收到以下错误:
Module '"mongoose"' has no exported member 'CreateQuery'.
Module '"mongoose"' has no exported member 'QueryFindBaseOptions'.
我尝试使用npm i @types/mongoose,但问题没有解决。
我还看到here,自 2021 年 6 月 3 日起不再需要上面的包,因为Mongoose publishes its own types, so you do not need to install this package.
解决这个错误的方法是什么?
【问题讨论】:
-
我没用过猫鼬,但一定能帮到你。你能告诉 used
CreateQuery在哪里使用吗?我的意思是你在哪里传递这个方法/变量 -
如果您深入研究源代码,您会发现没有导出
CreateQuery或QueryFindBaseOptions。您在哪里可以找到这些变量? -
@AmirSaleem 和 Cuong,我正在学习本教程:youtu.be/TbT7eO1fxuI?t=599
标签: node.js typescript mongoose