eventsAttended: [{ type: Schema.Types.ObjectId, ref: 'Event' }]
Ref is an option of mongoose to populate a field given a schema. So in case you omit ref in your "eventsAttended" field, you get only an objectID value, with no reference to any schema.
Docs here: https://mongoosejs.com/docs/api.html#schematype_SchemaType-ref
Guide here: https://mongoosejs.com/docs/populate.html
2.1m questions
2.1m answers
60 comments
57.0k users