【发布时间】:2021-10-16 11:53:21
【问题描述】:
我是 node.js 的新手,需要进行一些基本验证以检查两个字段(在本例中为密码)是否匹配,如果不匹配,则显示错误消息。我现在不担心加密,因为它超出了范围,因为这是 uni 任务的最后一部分。
我尝试创建可以传递给另一个变量的变量,但这并没有太大帮助。
这是我所拥有的缩短的 sn-p。
架构:
const customerSchema = new mongoose.Schema(
{
password:
{
type: String,
required: true,
},
rePassword:
{
type: String,
required: true,
},
已发布
app.post("/", function(req,res)
{
let newCustomer = Customer(
{
password: req.body.cPass,
rePassword: req.body.cConfPass,
任何帮助表示赞赏:)
【问题讨论】:
标签: node.js mongodb mongoose schema mongoose-schema