Mongoose select: false array ObjectIds

I'm trying to do something very similar to this , except that I don't want to reference the child schema directly. I am using ObjectId and Ref notation:

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

      

Anyway, for this? I don't see anything in the docs.

+3


source to share


1 answer


In retrospect, this should have been obvious:



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

      

+7


source







All Articles