Hello, is it possible to push to an array type? ...
# prisma-whats-new
u
Hello, is it possible to push to an array type? This mutation performs a $set rather than the $push i want
Copy code
mutation($varID: ID!, $varSteps:[String!]) {
  updateGoalDoc(id: $varID, steps: $varSteps){
    goal
    steps
    id
  }
}
Is this related to what I'm after here? https://github.com/graphcool/feature-requests/issues/127 I haven't really found any Graphcool examples yet that use an array of scalars. However it is curious that in the "Data" view I can graphically unshift to an array
j
@userzach you may be able to get around this by using functions within graph.cool on the pre event, you'd need to manually expand your array and the data to do it
👍 1
u
Thanks Jason. I'd like to be certain that this in fact absent from the API at the moment. @nilan
n
Hey, that's correct 🙂 Also, the feature request you linked to is about relations, not about scalar lists. Feel free to create a new feature request: https://github.com/graphcool/feature-requests
👍 1
I really like Jason's suggestion though, would love to add that as an example here https://github.com/graphcool-examples/functions, let me know if you got it to work 🙂
u
Okay! Much comfort in knowing! 🙂
n
hmm what possible operations do you want to support on scalar arrays?
u
At the moment I'd like to $push to an array of strings
n
yea just thinking about other use cases. If you want to support different operations for that field, you would need to encode the semantics in an additional field 😛
u
alright then.. if I can think of something i'll definitely make it heard
n
ya great if that works for you
j
@nilan in terms of an example, properly approach using a string and explode it out on the pre and post events?