32-bit signed integer java_GraphQL large integer error: Int cannot represent non 32-bit signed integ...

2017-07-08 03:45:08

1

I´m trying to store a UNIX timestamp in MongoDB using GraphQL, but it seens that GraphQL has a limit to handle integers. See the mutation below:

const addUser = {

type: UserType,

description: 'Add an user',

args: {

data: {

name: 'data',

type: new GraphQLNonNull(CompanyInputType)

}

},

resolve(root, params) {

params.data.creationTimestamp = Date.now();

const model = new UserModel(params.data);

const saved = model.save();

if (!saved)

throw new Error('Error adding user');

return saved;

}

}

Result:

"errors": [

{

"message": "Int cannot represent non 32-bit signed integer value: 1499484833027",

"locations": [

{

"line": 14,

"column": 5

}

],

"path": [

"addUser",

"creationTimestamp"

]

}

I´m currently using GraphQLInteger for this field on type definition:

creationTimestamp: {

type: GraphQLInt

}

How can I solve that situation if there is no larger GraphQLInt available in GraphQL ?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值