-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Description
Is there an existing issue for this?
- I have searched the existing issues.
Which plugins are affected?
Database, Other
Which platforms are affected?
Android, iOS, macOS
Description
When I tried to store a null float value or string value to the database, the null value is being converted to an empty string and stored to the database.
This should not be the case as null values are meant to be stored.
//schema.gql
type Menu @table(key: "id") {
id: UUID!
name: String!
docRef: String
index: Float
}
//mutation.gql
mutation SetMenu(
$id: UUID!
$name: String!
$docRef: String
$sortId: Float
) @auth(level: USER) {
menu_upsert(
data: {
id: $id
name: $name
docRef: $docRef
sortId: $sortId
}
)
}
//flutter code to set menu
await dbConnector
.setMenu(
id: "0420705a-60c0-46c2-8d41-0047e048ca3f,
name: "Breakfast"
)
.sortId(null)
.docRef(null).execute();
Calling the above will not save the data as the error below will be shown
Error copied from the dataconnect-debug.log
Variables:
{
"docRef": "",
"id": "0420705a-60c0-46c2-8d41-0047e048ca3f",
"name": "White Rice",
"sortId": "",
}
Errors: input: $sortId is invalid Float: unexpected value: with type: string
Taking out sortId from the table and queries stores the data but docRef is an empty string instead of null in the database.
Reproducing the issue
Create the table in the description.
Try adding data.
On VsCode, query the data with SQLTools
Notice that docRef column has empty string instead of null
Firebase Core version
3.9.0
Flutter Version
3.29.2
Relevant Log Output
Variables:
{
"docRef": "",
"id": "0420705a-60c0-46c2-8d41-0047e048ca3f",
"name": "White Rice",
"sortId": "",
}
Errors: input: $sortId is invalid Float: unexpected value: with type: string
Flutter dependencies
Expand Flutter dependencies
snippet
cloud_firestore: ^5.6.0
firebase_core: ^3.9.0
firebase_crashlytics: ^4.3.4
firebase_data_connect: ^0.1.4+1
firebase_messaging: ^15.1.6
firebase_storage: ^12.1.3
Additional context and comments
No response