Skip to content

Commit 56618c7

Browse files
authored
Merge pull request #185 from neo4j/nit-picky
Mutation pages updates
2 parents 106f5ef + 2050e5d commit 56618c7

File tree

5 files changed

+179
-138
lines changed

5 files changed

+179
-138
lines changed

modules/ROOT/pages/mutations/create.adoc

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
:description: This page describes how to create nodes through mutations.
33
= `create`
44

5-
Using the following type definitions:
5+
Consider the following type definitions:
66

77
[source, graphql, indent=0]
88
----
@@ -19,7 +19,7 @@ type User {
1919
}
2020
----
2121

22-
These `create` mutations and response types should be generated:
22+
The following `create` mutations and response types are generated:
2323

2424
[source, graphql, indent=0]
2525
----
@@ -65,11 +65,12 @@ mutation {
6565
}
6666
----
6767

68-
This should create a `User` with name "John Doe", and that name plus the autogenerated ID should be returned.
68+
This creates a `User` with the name "John Doe".
69+
The name and the autogenerated ID are returned.
6970

7071
== Nested `create`
7172

72-
A `User` and an initial `Post` can be created by executing the following:
73+
You can create a `User` and their initial `Post` at once by executing the following:
7374

7475
[source, graphql, indent=0]
7576
----
@@ -101,7 +102,7 @@ mutation {
101102
----
102103

103104
This creates a `User` with name "John Doe" and an introductory post.
104-
Both should be returned with their autogenerated IDs.
105+
Both are returned with their autogenerated IDs.
105106

106107
[NOTE]
107108
====
@@ -111,7 +112,7 @@ Read about xref:mutations/update.adoc#_connectorcreate_relationships[`update`] f
111112

112113
== `connectOrCreate` relationships
113114

114-
If a related node has the `@unique` directive defined, `connectOrCreate` can be used in a nested `create` to perform a `MERGE` operation on the related node.
115+
If a related node has the `@unique` directive defined, you can use `connectOrCreate` nested in a `CREATE` mutation to perform an operation similar to a link:https://neo4j.com/docs/cypher-manual/current/clauses/merge/[Cypher `MERGE`] operation on the related node.
115116
This will create a new relationship and the related node if it doesn't exist yet.
116117

117118
Consider the following type definitions:
@@ -130,7 +131,7 @@ type Movie {
130131
}
131132
----
132133

133-
Because a movie ID is unique, `connectOrCreate` can be used in an `Actor` mutation to ensure the movie exists in the database before connecting.
134+
Since a movie ID is unique, you can use `connectOrCreate` in an `Actor` mutation to ensure the movie exists in the database before connecting them.
134135
Note that only `@unique` or `@id` fields can be used in `where`:
135136

136137
[source, graphql, indent=0]
@@ -152,15 +153,17 @@ mutation {
152153
}
153154
----
154155

155-
This will ensure that a movie with ID 1234 exists and it is connected to `"Tom Hanks"`. If the movie does not exist, it will be created with the title `"Forrest Gump"`. Note that if the movie with the given ID already exists, it will be connected to it, regardless of the title.
156+
This ensures that a movie with ID 1234 exists and is connected to `"Tom Hanks"`.
157+
If the movie does not exist, it will be created with the title `"Forrest Gump"`.
158+
If a movie with the given ID already exists, it will also be connected to `"Tom Hanks"`, and keep whatever title it has.
156159

157160
== `CREATE` optimization
158161

159-
With the `create` operations, there is no limit on how many nodes can be created at once.
162+
With `CREATE` operations, there is no limit on how many nodes can be created at once.
160163
However, there is a known performance issue for large batch sizes.
161164

162165
The Neo4j GraphQL Library contains an optimization feature designed to mitigate it, but it does not work in the following scenarios:
163166

164167
* A field is populated using the directive `@populated_by`.
165-
* The `connect` or `connectOrCreate` operation is used.
168+
* The `connect` or `connectOrCreate` operations are used.
166169
* Interface and union types are present in the mutation.

modules/ROOT/pages/mutations/delete.adoc

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
= `delete`
66

7-
Using these type definitions:
7+
Consider these type definitions:
88

99
[source, graphql, indent=0]
1010
----
@@ -21,7 +21,7 @@ type User {
2121
}
2222
----
2323

24-
These `delete` mutations and response types should be generated:
24+
The following `delete` mutations and response types are generated:
2525

2626
[source, graphql, indent=0]
2727
----
@@ -43,7 +43,7 @@ The `DeleteInfo` type is the common return type for all delete mutations.
4343

4444
== Single `delete`
4545

46-
A single post can be deleted by executing the following GraphQL statement:
46+
You can delete a single post by executing the following GraphQL statement:
4747

4848
[source, graphql, indent=0]
4949
----
@@ -57,12 +57,12 @@ mutation {
5757
}
5858
----
5959

60-
This should delete the post using the autogenerated ID that was returned after that post's creation.
61-
Consequently, `nodesDeleted` should be equal `1` (the post) and `relationshipsDeleted` should also equal `1` as the `HAS_POST` relationship between the `Post` and its author was deleted.
60+
This deletes the post using the autogenerated ID that was returned after the creation of the post.
61+
Consequently, `nodesDeleted` is equal to `1` (the post) and `relationshipsDeleted` is also equal to `1` as the `HAS_POST` relationship between the `Post` and its author was deleted.
6262

6363
== Nested `delete`
6464

65-
In case you want to delete a `User` *and* all of their posts, you can use a single nested `delete` mutation:
65+
In case you want to delete a `User` and all of their posts, you can use a single nested `delete` mutation:
6666

6767
[source, graphql, indent=0]
6868
----
@@ -74,8 +74,7 @@ mutation {
7474
}
7575
----
7676

77-
By the time the traversal has reached it, that empty `where` argument has the context of only refer to posts that were created by Jane Doe, as the traversals to those `Post` nodes were from her `User` node.
78-
Essentially, the above query is equivalent to:
77+
This query is equivalent to:
7978

8079
[source, graphql, indent=0]
8180
----
@@ -104,10 +103,12 @@ mutation {
104103

105104
Note that the output Cypher statement should also have a redundant `WHERE` clause:
106105

106+
// !
107107
//Please add the cypher statement:
108108

109109
//[source, cypher, indent=0]
110110
//----
111111
//DELETE User (name:"Jane Doe")
112112
//WHERE Posts -
113113
//----
114+
// !

modules/ROOT/pages/mutations/index.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
:description: This section describes how to use mutations with the Neo4j GraphQL Library.
44

55

6-
This section addresses basic examples of the following mutations:
6+
This page shows examples of the following mutations:
77

88
- xref::mutations/create.adoc[`create`] - create nodes, and recursively create or connect further nodes in the graph.
99
- xref::mutations/update.adoc[`update`] - update nodes, and recursively perform any operations from there.
@@ -15,5 +15,5 @@ In order to provide the abstractions available in these mutations, the output Cy
1515
This can result in your database throwing out-of-memory errors depending on its configuration.
1616
1717
If this becomes a regular occurrence, you can adjust the link:https://neo4j.com/docs/operations-manual/current/configuration/configuration-settings/#config_server.memory.heap.max_size[`server.memory.heap.max_size`] parameter in the DBMS settings.
18-
If you need to perform major data migrations, it may be best to manually write the necessary Cypher and execute this directly in the database.
18+
If you must perform major data migrations, it may be best to manually write the necessary Cypher and execute this directly in the database.
1919
====

0 commit comments

Comments
 (0)