Comments (16)
Hey @AnsonHwang86 @bobmhong @tapnair thank you so much for your interest in this feature. I'm Hélène the Product Manager for Neo4j GraphQL library. Despite not being able to give you an exact timeline for when we'll be able to implement this, I can ensure you it's in the pipeline of our next priorities. Stay tuned ;)
from graphql.
Is there an update on this?
Also while not available as an auto generated mutation is there a good practice workaround?
from graphql.
Why ist nobody talking about this?
In my perspective, this is a major feature and while it´s not implemented we can not migrate to @neo4j/graphql.
@darrellwarde Can you tell us, when or if there are any plans implenting MERGE?
from graphql.
@darrellwarde Wondering if you're able to provide a rough timeline when generated MERGE mutations could be addressed?
Does it help if the implementation uses the suggestion provided by @mobsean
Maybe this will work:
a MERGE mutation will only be generated if atleast one @unique field ist defined in typeDefs.
from graphql.
Hi @AnsonHwang86
I like this idea, we will be evaluating different approaches for this shortly.
Sorry for taking this long to give an update on this 🙏
from graphql.
Why ist nobody talking about this?
In my perspective, this is a major feature and while it´s not implemented we can not migrate to @neo4j/graphql.
@darrellwarde Can you tell us, when or if there are any plans implenting MERGE?
It'll definitely get done, but there is no timeline yet.
At the moment we're looking at aggregations and interface relationship fields - they were prioritised as more important based on community and customer feedback.
from graphql.
Thanks for the detailed answers.
I´m happy to hear that you have plans to implement MERGE.
And I´m also with you that you have to have an Unique Field (btw. related issue: #206).
In the old implementation the first field in the typeDefinition was automatically unique, this was very bad documented and I fell for this quite badly.
Maybe this will work:
a MERGE mutation will only be generated if atleast one @unique field ist defined in typeDefs.
from graphql.
I'm working on a system for our datamodel which required idempotent insertion of data and had to hand write all the upsert mutations by hand. It's not a huge deal, but would certainly be nice if there was merge/upsert mutations that could be generated.
from graphql.
If nested upsert mutation would be supported, that is great.
Variables
{
"upsert": [{
"id":"a34-34534-sa3s-ee23",
"firstName": "John"
"lastName": "Luang",
"posts":{
"id":"s3d-s3353-asdf-fe34",
"title": "post title",
"comments":{
...
}
}
}]
}```
from graphql.
We're planning to investigate more on this feature request in the near future given the popularity that has reached. I'll keep you sorted!
from graphql.
We've working on a draft proposal for supporting MERGE
operations by implementing upsert
mutations. Here is an early example of how these mutations would look like:
mutation {
upsertMovies(input: [{
node: {
title: "The Matrix"
},
onCreate: {
stars: 0
},
onUpdate: {
released: 1999
}
}]) { title }
}
This would map to a MERGE
in Cypher:
MERGE (m:Movie {title: "The Matrix"})
ON CREATE SET
m.stars = 0
ON MATCH SET
m.released = 1999
from graphql.
I would like to chime in and mention that we left MERGE out for a few reasons; firstly, you need to MERGE on two unique fields and so that implies that nodes must have an id field, or something unique - something we don't enforce and then secondly, we couldn't find a nice way to get it to work with nested mutations. Finally, we found the mechanics of MERGE hard to reason about especially for your average GraphQL developer with less experience with Neo4j.
Of course, this doesn't negate the importance of MERGE, and in imparticular if you want to perform an atomic transaction.
Your ideas and suggestions are welcome here.
from graphql.
This would be fantastic, but to your earlier comment it would be particularly valuable if it works relatively seamlessly with nested mutations/queries.
from graphql.
waiting for this inplement
from graphql.
Hello, I suggest to use name of upsert
instead of merge
.
upsert - Wiktionaryhttps://en.wiktionary.org › wiki › upsert
(computing, databases) An operation that inserts rows into a database table if they do not already exist, or updates them if they do
merge
seen to be famiared to cypher user only.
Also please support upsert in batch(Array, many records) instead of object(one record).
type User{
id: ID @id
firstName: String
lastName: String
username: String @unique
}
mutation upsert($upsert: UserUpsertInput){
upsertUsers (upsert: $upsert){
users {
id
firstName
lastName
}
}
}
**Variables**
{
"upsert": [{
"id":"a34-34534-sa3s-ee23",
"firstName": "John"
"lastName": "Luang"
//if the same id existed, this record will be updated, other wise will be created(the id field will be give up and be autogenerated, because of @id directive).
},{
"firstName": "Sophia",
"lastName": "Qion",
"username": "sophiaqion"
//if the same username existed, this record will be updated, other wise will be created.
},{
"id":"",
"firstName": "Lan",
"lastName": "He"
//this rocord will be created, because there is not id offered or unique field offered.
}]
}```
from graphql.
any update?
from graphql.
Related Issues (20)
- Model.find({where: {id}}) returns wrong output. HOT 6
- Regression on ID scalar type filtering HOT 8
- Neo4jError: Variable `<propertyName>Count` not defined HOT 5
- Error "Cannot return null for non-nullable field" when limit exceeds result count in queries with non-nullable fields HOT 2
- Authorization rules can't compare enum property with context HOT 3
- Compatibility of @neo4j/graphql with neo4j-driver HOT 16
- GraphQL parsing issue with `[[String!]]!` HOT 2
- Filtering issue in `@authorization` directive HOT 2
- Nested mutation with deep connect inside a create is failing with the error- Neo4jError: Variable `this` already declared HOT 3
- Creating distinct relationships on interface field no longer possible since v5 if the interface does not include common identifier HOT 5
- @authentication doesn't work HOT 4
- ```authorization doesn't work``` HOT 1
- How to make custom resolver for create users
- Custom resolver for auto-generated resolvers HOT 2
- Spatial type projection fails if the `srid` is included in the SelectionSet HOT 2
- Generated `*OnCreateInput` types do not include fields to connect/create types with `@relationship` directives HOT 10
- Authorization filter causing undefined error HOT 2
- graphql-ogm with aggregations and full text searches HOT 1
- @neo4j/graphql:auth TypeError: Key for the RS256 algorithm must be one of type KeyObject or CryptoKey. Received an instance of Buffer HOT 17
- `{type}Connection` queries return results irrespective of the fulltext search phrase. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphql.