diff --git a/lib/schematype.js b/lib/schematype.js index 938a376c48b..82dd98ef568 100644 --- a/lib/schematype.js +++ b/lib/schematype.js @@ -960,8 +960,10 @@ SchemaType.prototype.required = function(required, message) { * const User = mongoose.model('User', userSchema); * * const postSchema = new Schema({ user: mongoose.ObjectId }); - * postSchema.path('user').ref('User'); // By model name - * postSchema.path('user').ref(User); // Can pass the model as well + * postSchema.path('user').ref('User'); // Can set ref to a model name + * postSchema.path('user').ref(User); // Or a model class + * postSchema.path('user').ref(() => 'User'); // Or a function that returns the model name + * postSchema.path('user').ref(() => User); // Or a function that returns the model class * * // Or you can just declare the `ref` inline in your schema * const postSchema2 = new Schema({