gpt4 book ai didi

Mongoose 选择:false an array of ObjectIds

转载 作者:行者123 更新时间:2023-12-02 19:14:34 26 4
gpt4 key购买 nike

我正在尝试做一些与 this 非常相似的事情,除了我不想直接引用子对象的架构。我正在使用 ObjectId 和 Ref 表示法:

children: [{ type: mongoose.Schema.Types.ObjectId, ref: 'SomeSchema' }]

有什么办法可以实现这个目标吗?我在文档中没有看到任何内容。

最佳答案

回想起来,这应该是显而易见的:

children: { 
type: [{ type: mongoose.Schema.Types.ObjectId, ref: 'SomeSchema'}],
select: false
}

关于 Mongoose 选择:false an array of ObjectIds,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30448071/

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