Closed Trellian closed 6 years ago
To answer as vaguely as the question was composed: yes the objection QueryBuilder is used and the insertAndFetchById
and updateAndFetchById
are there. :smile:
(ps. please add more information about what you are trying to do and where so that I can give you a real answer. Code examples always help alot)
@koskimas , I have yet again wasted your time... I was missing the 'Id' parameter, and completely misconstruing the error message. My apologies ') It works fine now. Also, please ignore my PR #30 for now , it has two small errors. I will fix it and re-issue.
Thanks
In implementing Mutations, I am trying to call
insertAndFetchByID
andupdateAndFetchByID
, to satisy theGraphQL
requirements to perform a Mutation and retrieve the results in a single trip, but theQueryBuilder
throws an error, saying that these operations are only available on an actual instance of theQueryBuilder
, and as a result I have to use the standardinsert
andupdate
methods.I am adding the fields requested as
update/insert (data, ['returning'])
to the calls as required for passing them toKnex
.Knex
accepts them and performs the operation without complaining, but I still only get an Integer in return, indicating number of records updated.I am guessing that
objection-graphql
is usingObjection.js's
staticQueryBuilder
methods in composing the calls toobjection.js
, and that is what is causing this?Currently, the end result of this problem is that I have to jump through hoops to update my Apollo Store Cache after the mutations, and a full invalidation of the cache is required. Ouch.
Is there a way around this, to get the desired behaviour?
Thanks!