前端学习(1342):验证规则出现错误
发布时间
阅读量:
阅读量

const mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/playground', { useUnifiedTopology: true })
.then(() => console.log('数据库连接成功'))
.catch(err => console.log(err, '数据库连接失败'))
//创建集合规则
const postSchema = new mongoose.Schema({
title: {
type: String,
require: [true, '请传入文章标题'],
minlength: [2, '输入长度不能小于2'],
maxlength: [5, '输入长度不能大于5'],const mongoose = require('mongoose');
mongo
全部评论 (0)
还没有任何评论哟~
