在下面的猫鼬模式中需要在这里指定 ref 什么?如果我们不指定呢?

What is need of specifying ref here in the below mongoose schema? What if we don't specify it?

 eventsAttended: [{ type: Schema.Types.ObjectId, ref: 'Event' }]

Ref 是 mongoose 的一个选项,用于填充给定模式的字段。因此,如果您在“eventsAttended”字段中省略 ref,您只会得到一个 objectID 值,而不会引用任何模式。

文档在这里: https://mongoosejs.com/docs/api.html#schematype_SchemaType-ref

指南在这里: https://mongoosejs.com/docs/populate.html