Skip to content

Commit

Permalink
Update intial-data.md (#3436)
Browse files Browse the repository at this point in the history
Fix an issue with connecting post with users , return fields were not specified .
  • Loading branch information
RAVIBHASKAR2000 authored Aug 24, 2020
1 parent ea367f7 commit 707a502
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions docs/tutorials/initial-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ const keystone = new Keystone({
{ data: { title: 'React is the Best' } },
{ data: { title: 'Keystone Rocks' } },
],
returnFields: 'id, title',
});

// 2. Insert User data with required relationship via nested mutations. `connect` requires an array of post item ids.
Expand All @@ -276,8 +277,9 @@ const keystone = new Keystone({
posts: {
// Filtering list of items where title contains the word `React`
connect: post.filter(p => /\bReact\b/i.test(p.title)).map(i => ({ id: i.id })),
},
},
},
},
},
{
data: {
name: 'Barry',
Expand Down

0 comments on commit 707a502

Please sign in to comment.