gqlify icon indicating copy to clipboard operation
gqlify copied to clipboard

Possibility to use other field as primary key

Open wwwy3y3 opened this issue 7 years ago • 1 comments

Describe the solution you'd like For example:

type User @GQLifyModel(dataSource: "firestore", key: "employees") {
  email: String! @unique
  name: String!
}

email field as primary key instead of firestore generated id.

Additional context

  • Does it affect relationship implementation?
  • On the other hand, do we allow composite primary keys?

wwwy3y3 avatar Dec 09 '18 08:12 wwwy3y3

I have a same problem!!!

@unique dosen't work in the schema this is m schema:

export const Article = `
type Article @GQLifyModel(dataSource: "mongodb", key: "articles") 
    { url: ID! @unique 
       title: String! img: 
       String content: String post: Boolean 
}`; 

But, but when I create a new article with the a just existent url, the mutation pass and create a new registry with a same url. the @unique dosen't work?

charlitoro avatar Mar 13 '19 22:03 charlitoro