You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _includes/graphql/files.md
+47-17Lines changed: 47 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,7 @@
3
3
The GraphQL API supports file upload via [GraphQL Upload](https://github.com/jaydenseric/graphql-upload), to send a `File` through `GraphQL` it's recommended to use the [Apollo Upload Client](https://github.com/jaydenseric/apollo-upload-client).
4
4
5
5
## Add a File field to a Class
6
+
6
7
First of all we will update our `GameScore` class with a `screenshot` field of type `File`.
7
8
8
9
```jsonc
@@ -12,15 +13,14 @@ First of all we will update our `GameScore` class with a `screenshot` field of t
Let's update a `GameScore` object and unset the file linked in the `screenshot` field. By setting the `screenshot` field to `null`, the linked file will be removed from the `Gamescore` object.
183
+
184
+
**Note:** The file will be not deleted from your file storage.
@@ -85,6 +81,7 @@ For example, if you have a class named `GameScore` in the schema, Parse Server a
85
81
"X-Parse-Master-Key":"MASTER_KEY"// (optional)
86
82
}
87
83
```
84
+
88
85
```graphql
89
86
# GraphQL
90
87
mutationupdateAGameScore {
@@ -114,8 +111,53 @@ mutation updateAGameScore {
114
111
}
115
112
}
116
113
```
114
+
117
115
**Note:** If you use [Apollo Client](https://www.apollographql.com/docs/react/) it's recommended to request the modified fields and `id` during the Mutation, then the [Apollo Client](https://www.apollographql.com/docs/react/) will automatically update its local store and push the new data across your app; i.e. If you update `playerName` you should request `playerName` and `id` like the code above.
118
116
117
+
### Unset a field
118
+
119
+
Across the whole GraphQL API you can simply unset a field by setting its value to `null`.
120
+
121
+
Following the official GraphQL API Specs, setting a field to `null` through the GraphQL API will completly unset the field in the database on the targeted Parse Object. GraphQL API will transform `null` on the server before saving the object to correctly unset the field into the database.
The GraphQL API will always return `null` if the field is `null` or `undefined` in the database. The GraphQL API does not differentiate between `null` and `undefined` in the data response.
160
+
119
161
## Delete
120
162
121
163
For each class in your application's schema, Parse Server automatically generates a custom mutation for deleting this class' objects through the GraphQL API.
@@ -170,20 +212,17 @@ The GraphQL API supports nested mutations, so you can create objects with comple
0 commit comments