0
const Films = new GraphQLObjectType({
  name: 'films',


  fields: () => ({
    id:{
        type: GraphQLString
      },
      name: {
        type: GraphQLString,

      },
      uniq_id: {
        type: GraphQLString,
    })

I want to give an alias name to the name field and fetch it with that name.

How can I do that? Please suggest............

Upasana
  • 45
  • 9
  • Thank you. here it gives alias in run time. means when someone fetches in query type But I want to give an alias name through which I can fetch directly – Upasana Feb 12 '19 at 14:11
  • Aliases are a client-side feature. It's not clear what you're trying to achieve. Do you want two separate fields that resolve to the same value? – Daniel Rearden Feb 12 '19 at 14:48
  • As you know we give some alias name in SQL query to a more readable format. Here in Films type name is a field. I want to give an alias name as first_name. So that When I fetch this field in query part I fetch it through first_name. – Upasana Feb 12 '19 at 17:43
  • GraphQL is agnostic to the underlying data layer. Unless you're using something like [join-monster](https://github.com/acarl005/join-monster), it has nothing to do with SQL. If you are, you should update your question to indicate as much. – Daniel Rearden Feb 12 '19 at 19:12
  • here i have not mentioned about join monster. i just want to give an alias name through which i can access it directly in query time no need to give it in that time. But i don't know whether it is possible or not??? Please tell me... – Upasana Feb 13 '19 at 05:27

0 Answers0