Hey guys - I was wondering if there's any guides/r...
# prisma-whats-new
k
Hey guys - I was wondering if there's any guides/references for adding in JSON data that contains relations to another node?
n
@kaihuang724 not quite sure what you mean with that, can you give an example?
k
Sure - basically I have a
Workout
node that contains a
sets
field that takes a JSON object. The JSON object will store multiple
Exercise
objects that refer to another node. What's the best way for me to do this?
This will be what the Workout data looks like
Copy code
`[
  {
    "id": "tt0068646",
    "name": "Power: Upper",
    "program": "cj3btwbm8062r01737sh6gq09",
    "sets": [
      {
        "id": "pendlay-row-id",
        "name": "Pendlay Row",
        "sets": 3,
        "reps": 5
      },
      {
        "id": "pull-ups-id",
        "name": "Pull Ups",
        "sets": 2,
        "reps": 10
      },
      {
        "id": "inverted-row-id",
        "name": "Inverted Row",
        "sets": 2,
        "reps": 10
      }
    ],
    "totalTime": 61
  }
]
`
Also - is there any way to set a query filter for an array of Enums?
n
No, enum lists don't have a filter right now
your JSON data seems great, what are you wondering about?
k
Hmmm, what would be the best way to filter for an enum list then? Should I just store it as an array of Strings?
Regarding the JSON data - I believe I resolved it.