Skip to content

Commit e37864d

Browse files
author
followDev
committed
username uniqueness added
1 parent fe2b5b9 commit e37864d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

models/User.js

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const userSchema = new mongoose.Schema(
1414
username: {
1515
type: String,
1616
required: true,
17+
unique: [true, "Username already exist"],
1718
},
1819
password: {
1920
type: String,

0 commit comments

Comments
 (0)