Reactjs GraphQL错误:应为Int类型。Int不能表示非整数值
我目前正在学习React的Reactjs GraphQL错误:应为Int类型。Int不能表示非整数值,reactjs,error-handling,graphql,react-apollo,apollo-client,Reactjs,Error Handling,Graphql,React Apollo,Apollo Client,我目前正在学习React的GraphQL和Apollo,我有一个问题在网上找不到答案: 我已经为我的mongoDB制作了一个表单来发送数据,我有以下查询: const addContactMutation = gql` mutation($name: String!, $address: String!, $vat: Int!, $zip: String!, $email: String!, $contact: Int!){ addContact(name: $name,
GraphQL
和Apollo
,我有一个问题在网上找不到答案:
我已经为我的mongoDB制作了一个表单来发送数据,我有以下查询:
const addContactMutation = gql`
mutation($name: String!, $address: String!, $vat: Int!, $zip: String!, $email: String!, $contact: Int!){
addContact(name: $name, address: $address, vat: $vat, zip: $zip, email: $email, contact: $contact){
name
vat
email
}
}
`
但是,我的$vat
和$contact
都是大数字,提交表单时我收到以下错误:
变量“$vat”的值“232214336”无效;应为Int类型。Int不能表示非整数值
我应该使用哪种类型?
232214336
没有那么大,最大整数是9007199254740991
console.log(Number.MAX\u SAFE\u整数)代码>如果bigint那么大,你不能只解析int,那么你如何处理graphQL以获得真正的bigint值呢?@PositiveGuy你可以使用自定义标量类型或bigint graphQL js库