In GraphQL should the names of fields in schema(typedef) and the names of fields in mongoDB model match for a getAll query resolver?
eg :- product has a field "name" in schema and "title" in model definition.
model for product :-
const ProductSchema= new mongoose.Schema ({
title:{
type : String,
required : true
}
);
schema for product :-
const Schema=buildSchema(`
type product{
_id : String
name : String
}
type Query{
getAllProducts : [ product ]
}
`);
Query for testing :-
query{
getAllProducts{
_id
name
}
}