我正在尝试结合两个模型属性来生成hash
。
我有这样的架构
const BlogPost = new Schema({
id: { type: String, required: true, unique: true },
empid: String,
date: Date
});
我想创建一个唯一的id
,它是组合hash
的{{1}}。如果生成相同的empid and date
,则会hash
错误。
我们可以结合gives
生成unique
吗?
如果我们通过empid and date
,会产生相同的哈希吗?那给我错误
这是我的代码 https://codesandbox.io/s/lively-tree-hd0fo
empid and date