gpt4 book ai didi

mongoose - 指定选择 : false on array of subdocuments in Schema

转载 作者:行者123 更新时间:2023-12-05 00:29:21 26 4
gpt4 key购买 nike

我正在寻找有关关闭属性选择的正确语法的帮助,该属性是一组子文档。我希望有一些类似的东西:

var UserSchema = new Schema(
{
fb_id : Number,
children : [{ type: CustomChildSchema,select:false}]
}
)
children数组有可能呈指数级增长,因此除非明确要求,否则我试图将它们排除在查询结果之外。

最佳答案

我想出了一个类似的问题,并使用下面稍微改变的语法解决了它

var UserSchema = new Schema(
{
fb_id : Number,
children : { type: [CustomChildSchema], select:false}
}
)

关于mongoose - 指定选择 : false on array of subdocuments in Schema,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17374293/

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