我在想是否可以使用Mongoose模式、Node.js和Angular动态创建MongoDB中的表格。
创建模式的基本方法是在Node.js中显式地创建一个模型,例如:
这个 schema 可以通过使用 Angular 前端的用户输入动态创建吗?
创建模式的基本方法是在Node.js中显式地创建一个模型,例如:
import mongoose from 'mongoose';
const Schema = mongoose.Schema;
const postSchema = new Schema({
title: { type: 'String', required: true },
content: { type: 'String', required: true },
slug: { type: 'String', required: true }
});
let Post = mongoose.model('Post', postSchema);
这个 schema 可以通过使用 Angular 前端的用户输入动态创建吗?