我有这个代码:
\n\nconst ProductType = new GraphQLObjectType({\n name: 'Product',\n fields: {\n id: { type: GraphQLID },\n name: { type: GraphQLString },\n category: {\n type: CategoryType,\n resolve: async (parent) => {\n return await Category.findOne({_id: parent.category});\n }\n }\n }\n});\n\nconst CategoryType = new GraphQLObjectType({\n name: 'Category',\n fields: {\n id: { type: GraphQLID },\n name: { type: GraphQLString },\n products: {\n type: ProductType,\n resolve: async (parent, args) => {\n return await Product.find({category: parent._id});\n }\n }\n }\n});\n\nconst Query = new GraphQLObjectType({\n name: 'Query',\n fields: {\n …Run Code Online (Sandbox Code Playgroud)