1
new mongoose.Schema({
  name: String,
  posts: [{
    title: String,
    body: String,
  }]
})

I will get something like

{
  "_id": ObjectId("xxx"), // which is OK
  "name": "xxx",
  "posts": [{
    "_id": ObjectId("yyy"), // which is what I dont want
    "title": "ttt",
    "body": "bbbb",
  }]
}

How can I make mongoose not create the _id inside posts?

Sato
  • 8,192
  • 17
  • 60
  • 115

0 Answers0