Skip to content

Commit b7d46a0

Browse files
committed
change from arrow function to function declaration
1 parent 9ab712c commit b7d46a0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/populate.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ const commentSchema = new Schema({
563563
doc: {
564564
type: Schema.Types.ObjectId,
565565
required: true,
566-
refPath: () => {
566+
refPath: function () {
567567
return this.docModel; // 'this' refers to the document being populated
568568
}
569569
},
@@ -605,7 +605,7 @@ regardless of how many models your `commentSchema` can point to.
605605

606606
<h2 id="dynamic-ref"><a href="#dynamic-ref">Dynamic References via <code>ref</code></a></h2>
607607

608-
Just like `refPath`, `ref` can also be assigned a function
608+
Just like `refPath`, `ref` can also be assigned a function.
609609

610610
```javascript
611611
const commentSchema = new Schema({
@@ -614,7 +614,7 @@ const commentSchema = new Schema({
614614
doc: {
615615
type: Schema.Types.ObjectId,
616616
required: true,
617-
ref: () => {
617+
ref: function() {
618618
return this.verifiedBuyer ? 'Product' : 'BlogPost'; // 'this' refers to the document being populated
619619
}
620620
},

0 commit comments

Comments
 (0)