7fife-backend/node_modules/mongoose/lib/helpers/schema/addAutoId.js

8 lines
173 B
JavaScript
Raw Normal View History

2024-03-07 13:01:44 +00:00
'use strict';
module.exports = function addAutoId(schema) {
const _obj = { _id: { auto: true } };
_obj._id[schema.options.typeKey] = 'ObjectId';
schema.add(_obj);
};