[英]How to define schema that will work both in mongoose & graphql
How to define a schema that works with React and Graphql promise based.如何定义适用于 React 和 Graphql promise 的架构。
const Cat = mongoose.model('Cat', { name: String });
You can define your schema like this:您可以像这样定义您的架构:
const userSchema = new mongoose.Schema(
{
__id: mongoose.Schema.Types.ObjectId,
email: {
type: String,
required: true
},
name: {
type: String,
required: true
},
password: {
type: String
}
},
{
timestamps: true
}
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.