I'm trying to do something very similar to this, except that I do not want to reference the child object's schema directly. I'm using the ObjectId & Ref notation:
children: [{ type: mongoose.Schema.Types.ObjectId, ref: 'SomeSchema' }]
Is there anyway to achieve this? I don't see anything in the docs.
In retrospect, this should have been obvious:
children: {
type: [{ type: mongoose.Schema.Types.ObjectId, ref: 'SomeSchema'}],
select: false
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With