Answer the question
In order to leave comments, you need to log in
How to create a Mongoose schema with an array and references to it in the same document?
There is a conditional model of the following content:
...
attachments: [{
_id: true,
alt: { type: String, default: '' },
url: { String }
}],
content: [{
title: String,
text: String,
attachments: [
// тут нужно ссылатся на this.attachments._id
]
}]
...
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question