gpt4 book ai didi

node.js - Mongoose 抑制警告选项

转载 作者:行者123 更新时间:2023-12-05 06:02:41 25 4
gpt4 key购买 nike

我在控制台中收到以下警告,因此这是由于顶级属性为 24 个字符的十六进制字符串。

warn: mongoose: To create a new ObjectId please try `Mongoose.Types.ObjectId` instead of using `Mongoose.Schema.ObjectId`. Set the `suppressWarning` option if you're trying to create a hex char path in your schema.

我在哪里可以设置 suppressWarning 选项?

最佳答案

在你的模式中试试这个:

const itemIdSchema = new Schema({
key: String
},{suppressWarning: true});

关于node.js - Mongoose 抑制警告选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66863865/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com