📅  最后修改于: 2022-03-11 15:03:35.057000             🧑  作者: Mango
var mongoose = require('mongoose');var uniqueValidator = require('mongoose-unique-validator'); var mySchema = mongoose.Schema(/* put your schema definition here */);mySchema.plugin(uniqueValidator);