problem with saving integers to fauna

Hey, I have a problem with saving integers to fauna. I am saving tweet id’s and some information is lost in the process, e.g. 1279679090530885632 becomes 1279679090530885600 (last two digits become 0). It obviously breaks my app. Previously I used to convert such id to strings and everything would be fine. I could do this now too, but I’d like to understand why this problem occurs. claims that faunadb’s number type can be 64-bit signed two’s complement integers (long ints), which imho should work with such a long number (e.g. rust u64 type manages it without a problem). Any ideas?


To get a bit more information, are you by any chance combining GraphQL and FQL?

No, I’m not. FYI my conversation with a Fauna employee on slack:

ME: saving to db with python; reading from the db with javascript; id’s in the db are distorted already, so the js driver is not relevant really (edited)

[Ben Edwards]

yeah, that is interesting.

I was expecting you to say saving with js (edited)

and then I was going to say “don’t do that”

but I guess we have a different conversation.

I guess I just need to see what is going on the wire with python.

it might be that its json serialization is helpfully sending it via double or something.

because we definitely have 64bit integers on the server side of things.

I’ll raise a ticket with the drivers team, in the mean time I’d just stick to using strings on the ids

Ok, Ben did create a ticket as he said so there is little we can do more to help you.

Fyi and for other people who stumble upon this post. PROD-722 in case you communicate with someone about this later on.

To my understanding, it happens if:

  • you store IDs in FaunaDB manually (and is happening due to how some language handle numbers in the language drivers)
  • you pass these as numbers
  • those numbers are higher than 2^53

As Ben said, in the meantime pass these as strings instead or doesn’t that solve your problem?
We can’t do more at this point though until that ticket is resolved.