is there a way to create alias of existing key for all models in mongoose express?

Viewed 98

I have 30+ models and now I have to create one alias for _id to id

to create an alias (aliases mongodb ) I am adding this key to all models

is there any way to create it for existing and new models I will add in future

HINT:- any common model setting are there in mongoose which helps me

REFERENCE:- sails js do this with sails model setting

EX in sails

 attributes: {
   id: { type: 'number', autoIncrement: true },// here setting for all models
   createdAt: { type: 'number', autoCreatedAt: true },
   updatedAt: { type: 'number', autoUpdatedAt: true },
 }
0 Answers
Related