How to create a Mongoose schema with an array and reference it in the same document?

There is a conditional model follows:
attachments: [{
 _id: true,
 alt: { type: String, default: "},
 url: { String }
content: [{
 title: String,
 text: String,
 attachments: [
 // here we need ssylatsya this.attachments._id

Please tell me how to configure the links from "content.attachments" in the array "attachments" and how this approach to do populate()?
April 4th 20 at 00:45
0 answer

Find more questions by tags MongoDBMongoose