Closed am-MongoDB closed 4 years ago
This is not something we have a choice on name, it is based off the collection name, which is called tasks. I am not sure how I feel about creating a collection using singular names.
Singular or plural collection/table names are an age-old argument, with points on both sides, but in this case I’m siding with Andrew. Given that we’re using a framework that doesn’t give us the option of de-pluralizing the generated API names, and considering that the purpose of the codebase is to show off those calls, we should use singular collection names because it produces better-looking example code.
Turns out that there's a solution. You can override the name used in the query and mutation names by adding a title
to the schema definition...
{ "title": "Task", "required": [ "title" ], "properties": { "_id": { "bsonType": "objectId" }, ....
done, renamed the collection and updated graphql.js
Having queries and mutations named things like
taskss
andinsertOneTasks
is jaring