Kalleria Kronos
Kalleria Kronos

Reputation: 13

Mongoose and GraphQL queries

Here I have a mongoose Schema

name : String,
class : String,
skills : [{ skill_name : String }]

How I do make it on GraphQL inputs ? so I can save them to mongodb

Like

input Students{
 name :String!
  class :String!
skills : "how to do it in here"?
}

Upvotes: 1

Views: 102

Answers (1)

Long Tran thanh
Long Tran thanh

Reputation: 86

Make GraphQL schema of input Student like this

input Students{
  name: String!
  class: String!
  skills: [String!]!
}

However, don't treat GraphQL schema and Mongoose schema the same. One is used for communicating client <-> server, other is used for server <-> database

Upvotes: 1

Related Questions