We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The graphUpsert offered by objection.js can also be used to insert data. It offers more flexibility when creating multiple records or relationships.
graphUpsert
Example use-case:
const data = [{ id: 'movie-one', name: 'Movie One', }, { id: 'movie-two', name: 'Movie Two' }];
A movie with the id movie-two already exists.
Create request: app.service('movies').create(data)
app.service('movies').create(data)
Response if using insert graph: Error: id provided has already been used
Error: id provided has already been used
Response if using upsert graph:
[{ id: 'movie-one', name: 'Movie One', createdAt: '2018-09-10T15:03:54.929Z', updatedAt: '2018-09-10T15:03:54.930Z' }, { id: 'movie-two', name: 'Movie Two', updatedAt: '2018-09-10T15:03:54.940Z' }]
This is just one of the many use-cases as it can also be used for relationships.
Suggested API: A new option called createUseUpsertGraph
createUseUpsertGraph
The text was updated successfully, but these errors were encountered:
NotAmaan
No branches or pull requests
The
graphUpsert
offered by objection.js can also be used to insert data. It offers more flexibility when creating multiple records or relationships.Example use-case:
A movie with the id movie-two already exists.
Create request:
app.service('movies').create(data)
Response if using insert graph:
Error: id provided has already been used
Response if using upsert graph:
This is just one of the many use-cases as it can also be used for relationships.
Suggested API:
A new option called
createUseUpsertGraph
The text was updated successfully, but these errors were encountered: