6

I have this one-to-many reference relationship in graphql with Mongo go driver.

type User {
    id: ObjectID!
    email: String!
    username: String!
    posts: [Post!]!
}

type Post {
    id: ObjectID!
    author: User!
    title: String!
    content: String!
}

I know that I can use the Aggregate framework to query the reference relationship.

However, What should I do if I want to create a user at the same time also create a post?

Sending two collection.InsertOne in the resolver?

Marios
  • 26,333
  • 8
  • 32
  • 52
The questioner
  • 724
  • 10
  • 21

0 Answers0