Is it possible with mongoose use a different name, in my case uppercase \'ID\', as an alias for the schema _id field? Would I need to add a virtual or is there another way o
The easiest way is to specify alias in the schema:
alias
let s = new Schema({ _id: { type: String, alias: "ID" } });
This automatically creates both getter and setter, so it is possible to use ID everywhere instead of _id.
ID
_id
Mongoose documentation on aliases