Live data from Hacker News

Ask HN: Do you still use MongoDB?

news.ycombinator.com

171–180 of 243 posts

Re: Ask HN: Do you still use MongoDB?

#171

Earlier quoted context omitted.

> I never understood the appeal of the JSON to SQL columns workflow. The appeal is non-technical. Writing good migrations, having tests around them to ensure they didn't leave the DB in an inconsistent state if a subset of them failed requires good understanding of a RDBMS and the specific product. You'll be surprised how many engineers don't meet that criteria. The JSON to SQL columns workflow allows any developer t…

This is not true. I'm using it because the cost of changing the schema for a feature that may only be experimental is too high. I started off changing the schema every time, and it just got too expensive. Using the JSON-to-SQL workflow, I can mess around with feature design and iterate fast, and then crystallise the schema into SQL once it has stopped changing. Writing solid migrations can end up being more complex t…

> This is not true.

Everything or certain parts of it?

> Using the JSON-to-SQL workflow, I can mess around with feature design and iterate fast, and then crystallise the schema into SQL once it has stopped changing.

Sure, you're experimenting and things are in a state of flux.

I get it. Been there done that, but not in production.

Your customers want features over reliability. This is perfectly OK at a startup - the customers already depend on a system elsewhere but that system does not meet all their needs so they are experimenting with you but if your company runs to the ground tomorrow, they still have not migrated 100% over to you, so they are "safe". If your software loses data, they probably won't even notice until they really start to move over for real and lose money (if they did not do testing for consistency).

In your position I would be honest and say data can be lost or corrupted and thats the price I am willing to pay for flexibility given the resource constraints I have.

It's too expensive to do things properly and customers don't really want that reliability so we can take some risks.

However, it would be naive to say you just designed an ACID complaint KV store by implementing some adhoc KV operations using JSON columns in a RDBMS.

I make a lot of money based off the disasters software like this creates when the original architect of such a system have "moved on" to other companies.

Data corruptions, losses, inconsistencies, meaningless key relationships, subpar performance (one place had two columns - an ID and a JSONB and were wondering why their query performance was poor, the DB locked so much and some updates never appeared to go through or "reset" the data).

There are KV-stores out there, that sell for a pretty penny, handle all KV conflict scenarios natively without the KV-store client having to worry about it (and doing a halfassed, buggy job about it because they are not DB designers and might not even know the bombs they are planting in their code. Maybe ignorance is bliss?). These systems have conflict resolution algorithms, offer CRDTs for the clients to use and engineers who know what they are doing, use them.

> The feature may not even make it to production

Feel free to do whatever you want with code that never makes it to production and affect people's livelihood.

I would argue you don't even need a DB to give you the warm fuzzy feelings and just do everything in memory.

Afterall, memory is cheap and configuring a DB correctly can get too expensive.

As an aside - if you're working at a company that regularly pushes features that do not even make it to production, there's a miscommunication issue.

Your business is bleeding money.

This is not to say overall, your business is not profitable - its just that it's bleeding money in that specific project and other more profitable ones are making up the slack.

At the minimum, the deliverable should be broken down into a POC and, when it's clear a production need absolutely exists, that POC is delivered production ready.

> Writing solid migrations can end up being more complex than the feature code itself

Sure, thats the price you pay for ACID compliance.

Nothing is free. There is no magic.

> I'm using it because the cost of changing the schema for a feature that may only be experimental is too high. I started off changing the schema every time, and it just got too expensive.

Again, you are free to do whatever you want in an experimental setup but we are talking production here.

If your proposal is you push the same design to production that you use in your experimental/POC setup, in a serious, well used and depended on production environment without anyone noticing, I would really like to know more! My contact info in the profile.

If your claim is you have figured out a way to get something for nothing - hmm.

The ROI of the businesses you help run just trended towards infinity!

Re: Ask HN: Do you still use MongoDB?

#172
Looking at the responses, I'm seeing a fair number of "No" responses. I recall a time when devs would practically rage on you if you dared question the decision to use Mongo. What changed? Is it just an example of dev cultism where the cult devs are the loudest?

Re: Ask HN: Do you still use MongoDB?

#174
post #62

There is a very recent Jepsen report on MongoDB. http://jepsen.io/analyses/mongodb-4.2.6 > Jepsen evaluated MongoDB version 4.2.6, and found that even at the strongest levels of read and write concern, it failed to preserve snapshot isolation. Instead, Jepsen observed read skew, cyclic information flow, duplicate writes, and internal consistency violations. Weak defaults meant that transactions could lose writes and…

Then don’t use the defaults? Sql Server use to have an empty password as a default for the Sa user and it was trivial to find servers exposed on the internet with the default password. While part of the blame was MS’s, it’s always on the person who does the installation to know what they are doing.

You should take a look at the Jepsen post. Kyle tested MongoDB at the highest integrity levels and still found problems.

Re: Ask HN: Do you still use MongoDB?

#175

Yes. I've been using mongo for various projects for 8+ years. I like the flexibility of the document model. No migration headaches. The query language is powerful and intuitive. I haven't used the graph features yet, but it is nice to know that Mongo can support it if that need ever comes up. I use mongo Atlas as a managed database for peace of mind. I use Redis in addition for caching. For testing/TDD i use mongo-me…

How do you handle issues around data integrity? From http://jepsen.io/analyses/mongodb-4.2.6

> Jepsen evaluated MongoDB version 4.2.6, and found that even at the strongest levels of read and write concern, it failed to preserve snapshot isolation. Instead, Jepsen observed read skew, cyclic information flow, duplicate writes, and internal consistency violations. Weak defaults meant that transactions could lose writes and allow dirty reads, even downgrading requested safety levels at the database and collection level.

Re: Ask HN: Do you still use MongoDB?

#176
post #53

Yes. We have applications running on both PostgreSQL and MongoDB and I find that working with MongoDB is just more pleasant. I think it mostly boils down to my preference of document databases as opposed to relational ones. It feels much more natural to me to embed / nest certain properties within a document instead of spreading it across several tables and then joining everything together to get the complete data. M…

How do you handle the data integrity issues that are present, even at the strongest configurable integrity levels, or is data integrity not an issue for your application?

Re: Ask HN: Do you still use MongoDB?

#177
post #74

Yes. If we were going to start from scratch today, we'd probably use Postgres. But, realistically, the primary motivation behind that decision would be because Postgres is available on AWS, and that would centralize more of our operations. (DocumentDB is, of course available. Its not Mongo. I'd be curious to hear from people who actually had Mongo deployments and were able to move to DocumentDB; its missing so many o…

I'll give you a reason that not many people mention not to use Mongo. Schema definition acts as a form of documentation for your database. As someone that has come into a legacy project built on Mongo, its a nightmare trying to work out the structure of the database. Especially as there is redundant copies of some data in different collections.

Re: Ask HN: Do you still use MongoDB?

#178
post #112

I've actually never used it, and probably won't at this point. But, we do use Couchbase at my workplace, and it's worked well for us. The use case is very limited in scope, but it serves our purposes well. I'd be curious to know how they compare from folks who have used both?

Depends on what you're doing, I suppose. CouchDB's multimaster concurrency features are still effectively best in class, but there are so many managed DB services now, that it doesn't seem like a headline feature.

The RESTful interface is pretty cool. And Couch's in-built security features are near enough a best kept secret.

CouchDB always lost to Mongo in discussions about speed unfortunately. Data safety and security notwithstanding. You can speed it up if you're willing to use Erlang as the primary query language, which wasn't something many were keen to do.

Another big hamstring is data modelling in a document db...

I'm not a data scientist, but anytime I hear complaints about Mongo, and have access to the codebase that's the subject of the complaint, I invariably find whopping great multi-property entities confined to a single document, without anything close to an attempt to normalise the data (or worse, a concerted intellectual effort to stuff everything into a single document...).

There's more I can say...

I think CouchDB is woefully underrated.

It's on version 3 now...

Re: Ask HN: Do you still use MongoDB?

#179

I can't help noticing that the majority - not all, but the majority - of "No." responses here summarize identically: someone used MongoDB a long time ago (between 5 and 11 years) and ran into a problem, so they stopped using it and will never try or re-evaluate it again. I'm a bit surprised that developers and systems engineers get burned to the point that they disconnect from the daily reality of their occupation, t…

Apple is is using AMD GPUs for basically that reason though

Re: Ask HN: Do you still use MongoDB?

#180

I haven't used it for a while and I've been planning on learning Postgres after much praise from a friend (and the internet at large). I find DB design and migrations quite difficult though, any book/course recommendation?

I don't have a specific book for you, I myself learned about relational databases at school, not sure why is not being taught everywhere.

The things that you have problems with aren't really specific to PostgreSQL so if you are looking for a book while one based on PostgreSQL might be easier, there might be better books that talk about relational databases and what you learn will still apply.

About migrations, from PostgreSQL point of view you just use ALTER TABLE, CREATE INDEX, DROP INDEX etc. it's fairly trivial.

The problem comes that developers want to have it version controlled. So a framework around it is often built. Typically that functionality comes with whatever framework you are planning to use. For example if you use Python and Django framework it comes with migrations functionality, so you just learn what the framework provides.

Post reply on HN