const nft = new mongoose.Schema(
{
name: String,
owner: String,
ownerPicture: String,
group: String,
groupPicture: String,
code: {
type: String,
default: uuidv4(),
unique:true
},
producedBy: String,
competeIn: String,
description: String,
nft: String,
nftDestination: String,
},
{ timestamps: true }
);
This is my mongoose Schema and it working fine. But the the default value for code is giving me the same uuid for every model. I want it to be unique every time. When ever I make a new model of this schema. The code value always remain the same. Please give me a solution to this.