Skip to content

Does not remove all _ids #47

@r0757431

Description

@r0757431

Assume adding this (noted in bold) to your example:

const personSchema = mongoose.Schema({
  name: String,
  age: Number,
  email: String,
  password: { type: String, private: true },
  tracklist: {
    type: [
      {
        track: String,
          title: String,
      }
    ],
    validate: v => Array.isArray(v) && v.length > 0,
  }
});

personSchema.plugin(normalize);

const Person = mongoose.model('Person', personSchema);

const someone = new Person({
  name: 'Abraham',
  age: 33,
  email: '[email protected]',
  password: 'my_awesome_password',
  tracklist: [
    {
      track: "1",
      title: "1"
    },
    {
      track:"2",
      title:"2"
    }]
});

Then the output will still contain _ids:

{
  "name": "Abraham",
  "age": 33,
  "email": "[email protected]",
  "tracklist": [
    {
      "track": "1",
      "title": "1",
      "_id": "6361521b2b1edf8bd136a3f0"
    },
    {
      "track": "2",
      "title": "2",
      "_id": "6361521b2b1edf8bd136a3f1"
    }
  ],
  "id": "6361521b2b1edf8bd136a3ef"
}

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions