News for hackers. Stuff that matters.
Re:Mongo but on Postgres and with strong consistency benefits by jamil7 on Monday July 08, 2024 @01:30AM (#40902836)
I don’t do much backend work at the moment but I found using JSONB fields for prototyping endpoints to be quite handy. Once I had a feature figured out and working, I’d create a proper schema.
Re:Mongo but on Postgres and with strong consistency benefits by marcus_holmes on Monday July 08, 2024 @05:45AM (#40904002)
I've found Postgres' Hstore type useful for this, too.

I often create a "metadata" hstore field on a table and use it for random bits of data I don't want to create an actual field for yet. When I find that the application needs that bit of data and in a certain format, I'll move it into an actual field.

Re:Mongo but on Postgres and with strong consistency benefits by cryptonector on Monday July 08, 2024 @12:39PM (#40906910)
hstore is basically the flat precursor to JSONB, and IMO it's as good as obsolete. I wouldn't use hstore in a new project, just JSONB.
Re:Mongo but on Postgres and with strong consistency benefits by marcus_holmes on Monday July 08, 2024 @08:45PM (#40911443)
I get that, but I think the temptation to add too much structure to the JSONB would be too great; this is just a temporary or prototype field, so it just needs a name and a value. Hstore works great for this.
Re:Mongo but on Postgres and with strong consistency benefits by cryptonector on Tuesday July 09, 2024 @11:53AM (#40917544)
And I get that, but also hstore is ugly. Just be disciplined :)