Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这样的架构:
new mongoose.Schema({ name: String, uniq: {type: String, default: Math.random() + "a"}, })
我不能随机,但只能null用于 uniq 字段
null
是否可以默认使用自定义功能?
采用
uniq: {type: String, default: function(){ return Math.random() + "a"; } }
检查猫鼬文件。