Comparison of mutations between neo4j-graphql-js
and @neo4j/graphql
.
type Product {
id: ID
name: String
photos: [Photo] @relationship(type: "HAS_PHOTO", direction: OUT)
}
type Photo {
id: ID
url: String
name: String
color: Color @relationship(type: "HAS_COLOR", direction: OUT)
}
type Color {
name: String
}
mutation {
createProducts(
input: [
{
id: "pringles_product_id"
name: "Pringles"
photos: {
create: [
{
id: "green_photo_id"
url: "green_photo_url.com"
name: "Green photo"
color: { connect: { where: { name: "Green" } } } # existing color
}
{
id: "red_photo_id"
url: "outdoor_photo_url.com"
name: "Red photo"
color: { connect: { where: { name: "Red" } } } # existing color
}
]
}
}
]
) {
id
}
}
mutation {
product: CreateProduct(id: "pringles_product_id", name: "Pringles") {
id
}
greenPhoto: CreatePhoto(
id: "green_photo_id"
url: "green_photo_url.com"
name: "Green Photo"
) {
id
}
connectedProductGreenPhoto: MergeProductPhotos(
from: { id: "pringles_product_id" }
to: { id: "green_photo_id" }
) {
to {
id
}
}
connectGreenPhotoColor: MergePhotoColor(
from: { id: "green_photo_id" }
to: { name: "Green" }
) {
to {
name
}
}
redPhoto: CreatePhoto(
id: "red_photo_id"
url: "red_photo_url.com"
name: "Red Photo"
) {
id
}
connectedProductRedPhoto: MergeProductPhotos(
from: { id: "pringles_product_id" }
to: { id: "red_photo_id" }
) {
to {
id
}
}
connectRedPhotoColor: MergePhotoColor(
from: { id: "red_photo_id" }
to: { name: "Red" }
) {
to {
name
}
}
}