This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
Where with GraphQL you have some advantage I think where you can determine kind of how it's used, while with rest you don't really no up front. For example say you have a rest for getting a list and a separate one for getting the details, you kind of need to know up front what the users op your api want for the summary. But they might end up calling the detail view for everything if they want something else.
My current team is about to start working on a new api, but I seem to be the only one in favour of GraphQl, but also since we're on mongo I'm not sure if it's a great idea. On the other hand we could just keep the schema very flat.
When your app is backed by mongo, rest vs GraphQL is the least of your problem. It is a Greenspun’s tenth waiting to happen.
Make sure you have schemas/specs in place, its the only way to know way to know what’s being put in your db.
Make sure you enforce the foreign key constraints. Both when adding and deleting. Also, make sure you do cascading deletes.
Bottom line is that data inconsistencies is just eating for a chance to happen when you use Mongo.
Just to finish this off. When working in a language where all your entities tend to be maps, it’s nice to have some definitions of the shape of the data somewhere.
That is, avoid making fields non-nullable unless you have some kind of system guarantee that they will always be filled.
(It’s way too easy to assume that chunks of data will always be there just because they’re there most of the time)
The current problem is more that we have multiple definitions for the some things then none.. Also we're moving some things to Postgres already, and might do more. But we've had a lot of problems related to data consistency indeed.
I'm more worried when they are going to do some 'joins' but we could prevent that from the schema and/or make the data in such a way it's not needed.