DbRef with Mongoose - mongoose-dbref or fill?

I have the following two schemes:

Company Event:

var companyEventSchema = new Schema({
    name : String,
    description
    date : Date,
    attendees : [ { type : Schema.ObjectId, ref : 'Member' } ],
]});

And member

var memberSchema = new Schema({
    name : String,
    emailAddress: String,
    password :String,
    created: { type: Date, default: Date.now }
});

Is the way I answered Member from companyEventSchema correctly? I am trying to do something long dbref string.

I saw a separate project for them, though ... mongoose-dbref

However, mongoose docs say the above provides a "dbref like function"

What would be more effective?

+3
source share
1 answer

DBRef ( mongoose-dbref) , ObjectIds, . A DBRef ObjectId, .

Mongoose ref: ObjectId, Mongoose, , ObjectIds.

, Mongoose ref: , , DBRef.

+9

All Articles