Live data from Hacker News

Never, ever, ever use MongoDB

cryto.net

51–60 of 122 posts

Re: Never, ever, ever use MongoDB

#51
post #30
post #15

Earlier quoted context omitted.

MongoDB has THE WORST vendor lock-in imaginable, so only use it if you know that you could throw everything away. Source: my last employer used MongoDB, and switching to an RDBMS would have forced us to rewrite ~80% of the codebase.

About 80% rewrite: it is poor abstraction problem rather then vendor lock-in one

[deleted]

Re: Never, ever, ever use MongoDB

#52

Now with PostgreSQL 9.4 there isn't really any reason to use MongoDB (JSONB is better suited than BSON). For any other use CouchDB.

There are a few. Mongo has excellent integration with Hadoop and is becoming very popular in the big data analytics space. Likewise it is gaining traction in the EDW space as a result of their partnerships. Also it stills remains one of the simplest databases to setup and use making it still my goto for hacks/spikes.

As simple as sqlite with a decent ORM? Just curious here, I've never tried Mongo.

Re: Never, ever, ever use MongoDB

#53
I did the MongoDB class they offer but was always scared to use in production (after reading so many bad experiences). And it's really too bad. I find JSON is just so much more pleasant to deal with than SQL.

Re: Never, ever, ever use MongoDB

#54

Earlier quoted context omitted.

If your data really doesnt matter you might as well just use ElasticSearch as a document store, its a lot easier anyways

ES is wicked easy to setup and use, but it's not recommended as the primary data store for split-brain scenarios, IIRC.

OP was talking about hackathons.

Re: Never, ever, ever use MongoDB

#55
post #18
post #9

I think people only use it because it stores JSON and let's you query it arbitrarily on demand. It appears to be as good as CouchDB, but with on-demand queries, as good as Postgres, but with JSON (!). It appears to be quick and easy and the tool for the job. Also, when people say NoSQL they actually mean MongoDB.

Cassandra, Couch, Redis, Riak, Dynamo...

Postgres, MySQL, RethinkDB...

Re: Never, ever, ever use MongoDB

#56
post #39

Relationships in MongoDB are commonly stored as ObjectID references, and (at least on node) the default Mongo client (Mongoose) makes you write schemas to enforce these. I think Mongo is awful too, and I'm sure there are problems with this approach - I'd love for someone with more DB knowledge to go into details - but saying there are 'no relations' seems to be an oversimplification.

Mongoose is a client-side library. It emulates relations and schemas client-side, as I also pointed out in the article.This also means that the database cannot optimize for relations and schemas, as it doesn't even know they exist . Mongoose is also very much not the default MongoDB client in Node.js - it's a third-party client library by Automattic. The official client according to the MongoDB documentation is `mong…

I have used and am aware of node-mongodb-native (I wrote http://stackoverflow.com/questions/19546561/node-mongodb-err... where we discovered it wrapped and threw away all exceptions in callbacks in the stable production version ), but Mongo (the company) have recommended Mongoose. The language now is vaguer than it was 'you can use it natively if you want, or use Mongoose' http://docs.mongodb.org/ecosystem/drivers/node-js/

Thanks for your excellent explanation and totally understood re: not being able to optimise for relationships on the server.

Re: Never, ever, ever use MongoDB

#57

Now with PostgreSQL 9.4 there isn't really any reason to use MongoDB (JSONB is better suited than BSON). For any other use CouchDB.

There are a few. Mongo has excellent integration with Hadoop and is becoming very popular in the big data analytics space. Likewise it is gaining traction in the EDW space as a result of their partnerships. Also it stills remains one of the simplest databases to setup and use making it still my goto for hacks/spikes.

> Also it stills remains one of the simplest databases to setup and use making it still my goto for hacks/spikes.

It's not hard to make it easy to do a thing in the wrong way - and that's exactly what MongoDB does. It doesn't make you set up authentication or table schemas, so it looks 'really easy to set up'.

In reality, though, you're wasting hours to save 10 minutes. Because at a later point, you're going to have your database broken into (if it can even be called that, without authentication), or you end up corrupting your data because two of your applications disagree over what the current object schema is.

To know how easy something really is, you need to compare how hard it is to set something up correctly. And once you do that, MongoDB falls far behind.

Re: Never, ever, ever use MongoDB

#59
post #56

Earlier quoted context omitted.

Mongoose is a client-side library. It emulates relations and schemas client-side, as I also pointed out in the article.This also means that the database cannot optimize for relations and schemas, as it doesn't even know they exist . Mongoose is also very much not the default MongoDB client in Node.js - it's a third-party client library by Automattic. The official client according to the MongoDB documentation is `mong…

I have used and am aware of node-mongodb-native (I wrote http://stackoverflow.com/questions/19546561/node-mongodb-err... where we discovered it wrapped and threw away all exceptions in callbacks in the stable production version ), but Mongo (the company) have recommended Mongoose. The language now is vaguer than it was 'you can use it natively if you want, or use Mongoose' http://docs.mongodb.org/ecosystem/drivers/no…

I actually didn't even notice Mongoose being mentioned on that page, to be honest, given that the instructions were for `mongodb`. I'd imagine that neither would a developer skimming the page :)

Re: Never, ever, ever use MongoDB

#60
post #36

I've used MongoDB recently for the first time, for an internal project. Being schemaless, I believe it did speed up development time significantly, and allowed me to add stuff more gradually, but you could say that's just a way to indulge a certain laziness of design. Now that the project has matured, stepping back I can see how a relational database would be a better fit, but if I had used a rdbms from the beginning…

The article mentions CouchDB and other schematic-less, document DBS, which should be equally good for prototyping but suck less.

I don't understand why a schemaless database is so great for prototyping. Most of the pain from schema changes is when you have a lot of code or a lot of users depending on an existing schema, so it's hard to change (or at least, hard to change while maintaining uptime). Running ALTER TABLE on a small dataset with almost no users is trivial.
Post reply on HN