mongodb-appeng / taskit

A simple todo application make use of MongoDB Stitch & GraphQL
Apache License 2.0
2 stars 0 forks source link

Name the collection `Task` instead of `Taskss` #7

Closed am-MongoDB closed 4 years ago

am-MongoDB commented 4 years ago

Having queries and mutations named things like taskss and insertOneTasks is jaring

shawnbmccarthy commented 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.

ashitaka1 commented 4 years ago

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.

am-MongoDB commented 4 years ago

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" }, ....

shawnbmccarthy commented 4 years ago

done, renamed the collection and updated graphql.js