how would one go about seeding a many to many rela...
# orm-help
m
how would one go about seeding a many to many relation like this? Assuming you had a json similar to this
Copy code
[
   { 
      name: 'some name', 
      posts: [ { title: 'title', content: 'some content' }, ....]
   },
  { ....} 
]
r
The json is the category name along with the posts?
m
correct
looping through each category and creating every post is creating duplicates
r
Are the categories not unique in the json?
m
They are
Is creating duplicate posts i mean
Assuming other categories share the same post
Maybe post/categories is a bad name for this example
r
In that case, you need something unique to identify if the post is a duplicate or not.
Otherwise this is hard to perform.
m
Hmm