Specifying select: false in an array of subdocuments in a Schema

I am looking for help with the correct syntax to disable the selection of a property, which is an array of subdocuments. I was hoping for something like this:

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

children array has potential for exponential growth, so I'm trying to save these results without asking.

+4
source share
1 answer

I ran into a similar problem and solved it with a slightly modified syntax below

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

Source: https://habr.com/ru/post/1488777/


All Articles