GrapQL with .net core for multiple schema

Viewed 252

How to handle multiple schemas using GraphQL with .net-core query and mutation

Eg.: I have two entities books and authors. I need to insert records from these two entitiies to MongoDB.

How can I use ISchema and single controller to handle mutation of the above two entities?

1 Answers

I think this is what you are searching for: https://www.youtube.com/watch?v=4XmQi80nFes and here is how to set it into your Mongo DB: https://www.tutorialspoint.com/mongodb/mongodb_insert_document.htm

Inserting your values to MongoDB can be done with .insertMany

db.inventory.insertMany([
   { item: "journal", qty: 25, tags: ["blank", "red"], size: { h: 14, w: 21, uom: "cm" } },
   { item: "mat", qty: 85, tags: ["gray"], size: { h: 27.9, w: 35.5, uom: "cm" } },
   { item: "mousepad", qty: 25, tags: ["gel", "blue"], size: { h: 19, w: 22.85, uom: "cm" } }
])
Related