Dashboard Edit can cause errors with graphql

Screen Shot 2022-03-08 at 10.15.27 PM

On the dashboard, in the collections, there’s an edit button there that allows you to edit the document, however, this can cause errors when you are using graphql, particularly because that edit functionality does not seem to convert values to proper types, example would be when we’re using ToDouble function → read Graphql custom query error: Can't convert '9' to double - #6 by ptpaterson to find out more

Essentially when you have a field there that’s a Double, it becomes somehow NOT Double after the edit, which will cause error in the graphql.

I moved this to Feature Requests. It’s a good follow-up to the previous topic!

To clarify, the issue is that whole numbers written in FQL in the Dashboard are serialized to integers, not that all floats are converted to integers. For example 9.0 gets serialized to 9 and thus saved as an integer in the database. 9.1 will, on the other hand, be serialized as the decimal number an correctly saved as a floating point number in the database.


Native schema enforcement: Schema enforcement at the DB level could implement type coercion, keeping your data types in sync whether you use GraphQL or FQL.

Improved data marshaling in the Dashboard fql editors: The reason this happens is that the javascript doesn’t differentiate between integers and floating-point numbers, so the JS driver cannot distinguish between 9.0 and 9, and they both get serialized as just 9. This proposal would make sure that the Dashboard would respect the number format the user enters, through an update to the JS driver or otherwise.


  1. Use ToDouble to set the value with FQL
  2. Set the values in Graphql whenever possible. GraphQL correctly respects the number types when it serializes them and sends to the database

Is this like how we do it in MySQL? Because one thing that I like about FaunaDB is how it’s not enforcing any schema like how we do in MySQL, hopefully the flexibility that we get without schema is not going to be compromised when we start to enforced schema. Another solution is for the dashboard to check if there’s a schema.graphql uploaded, if so then you probably want to ensure that the data are serialized according to that schema while still allowing for some fields not defined in the schema to be serialized in a default manner, basically:

serialization = {

Definitely! That flexibility is one of Fauna’s strongsuites. The schema enforcement that we’re working on is all opt-in and not required :slight_smile:

1 Like