I have a schema where _id
is not ObjectId
, but a string, that is generated from the name field:
var accountGroupSchema = new mongoose.Schema({
_id: { type: String, default: '' },
name: { type: String, default: '' },
permissions: [{
name: String,
permit: Boolean
}]
});
If I need to update it first I need to remove the whole document because _id
is immutable. Is there any way to keep another fields, in this case, permissions, and add them to a new document?
Thank you.