我正在使用graphql和mongodb创建一个api。在架构内部,我正在填充用户
import mongoose, { Schema } from 'mongoose';
const organizationSchema = new mongoose.Schema(
{
users: [{ type: Schema.Types.ObjectId, ref: 'User' }],
name: String,
urlName: String
},
{ timestamps: true }
);
const Organization = mongoose.model('Organization', organizationSchema);
export default Organization;
userDef是这个
type Folder {
id: ID!
title: String!
files: [File]
}
问题在于,当我发出请求时,文档将被保存为数据库中没有任何类型的文件,因为它应该像这样。 [0] Objectid(“ 5f9d9f73dd7fad1a045e531d”)。如何定义userDef,使其不接受任何名称值
type Folder {
"no name": ID!
title: String!
files: [File]
}