Live data from Hacker News

Was MongoDB Ever the Right Choice?

simplethread.com

201–210 of 224 posts

Re: Was MongoDB Ever the Right Choice?

#201
post #99
post #62

Earlier quoted context omitted.

The problem with thinking a library like Mongoose satisfies those constraints is that it only works with a single application. Every database I've worked with that made it beyond a prototype outlived the original application. So you either end up building an RDBMS app/api in front of mongo for every new application to use or you have to translate those constraints to every client. I'm of the opinion to let the "aweso…

True, using a library to hide the limitations of a DB smells bad. It is fixing the problem in the wrong location. I may have misread your comment but rarely do more than one client application access a database. Especially in today's often Microservices architecture. So using a library as mentioned is fine. And as the app evolves/gets rewritten you can keep the library or replace it with a similar one. Over 10+ years…

> rarely do more than one client application access a database

That has not been my experience!

Re: Was MongoDB Ever the Right Choice?

#202

I hate these kinds of articles, however, I do recognise that people are allowed their opinions, which is good. But these sorts of articles take a very polarised view of the world. > Does this tool solve a real problem for us > Do we thoroughly understand the tradeoffs Well, no. But neither did running JS on the server (along with numerous other similar examples). I've used MongoDB plenty of times before (in productio…

> running JS on the server

Huh? Enough people apparently knew JavaScript well enough that running it on a server was really useful. Why's that not a real problem? (Not being able to do so.)

Re: Was MongoDB Ever the Right Choice?

#203
post #43

I would argue that MongoDB is not—and has never been—the best choice for solving any particular technical problem. But it had some other "advantages" over other, better solutions – in that it was easier to set up, didn't require schema definition, had a passable clustering story etc. I have worked with at least one company that had been built using MongoDB as a primary data store from day one. This caused untold pain…

I once worked for a company where Lotus Notes fulfilled a similar role (this was back in the late 1990s). Eventually they ran an entire free to sign up web-based email system using 4 giant Notes instances. It was an absolute nightmare, but probably the company would never have happened otherwise because Notes was all that the founders knew. My job was managing the migration off to a normal SQL database, which took th…

I used to work for a company that occasionally had to interact with others' Lotus Notes setups.

At one point, there was some discussion about migrating one of our systems to a document store. There was a fair bit of back-and-forth at first. After someone pointed out that Lotus Notes is basically a document store, though, the idea was dropped more-or-less immediately and unanimously.

I can see the attraction when you're just starting out on a project, but we had just spent way too much time dealing with what they're like after they've had time to mature into full-blown quagmires.

Re: Was MongoDB Ever the Right Choice?

#204

Earlier quoted context omitted.

And the tooling around it? For instance the Mongo C# Linq driver can translate LINQ to MongoQuery.

I haven't used myself but have heard good things: http://jasperfx.github.io/marten/documentation/documents/que...

I've been using this in production for around 1 year - it's an absolute dream to use!

For context, I've previous experience with NHibernate, EF, EF Core, Dapper and some others from yesteryear - Marten is probably the best dev experience I've had from an ORM.

Re: Was MongoDB Ever the Right Choice?

#205

Earlier quoted context omitted.

Writing DDLs are hard when you don’t know in advanced what the schema is or the schema is changing frequently. A lot of things “become popular” but that doesn’t necessarily mean they are good.

All the SQL databases with which I'm familiar support large string columns. What's the downside to just stuffing your schema-less or volatile-schema data in one of those?

The downside is that you can’t easily query against the individual fields and you can’t index individual JSON fields.

I’m bringing up C# again...

Querying with Mongo using the Mongo driver in C#....

  var people = db.GetCollection().AsQueryable();

  var seniorMales = from p in people where p.Age >= 65 && p.Sex == “M” select p;

Querying an RDMS with EF:

  var people = context.People;

  var seniorMales = from p in people where p.Age >= 65 && p.Sex == “M” select p;
Both queries get translated to their respective query languages and run on the server. C# enforces the types in either case and you get compile time type checking and IDE Intellisense. In either case you can index the Age and Sex fields.

NoSQL databases aren’t “schemaless”. Mongo understands the schema of JSON data and can query against it just like an RDMS understands rows and columns.

Re: Was MongoDB Ever the Right Choice?

#206

Earlier quoted context omitted.

The thing is, it's too late. When MongoDB was in its heyday, it got known as something that loses records. Not much you can do now when for every post affirming its consistency, there are two about how someone tested it and it failed consistency checks.

I'm not disagreeing with anybody else's test results. Just want to say that MongoDB has matured a lot and people should test out the newer versions to see how they fare. Kind of in line with the article, I think that people should methodically check what works for them... particularly for something as serious as a database. It would be a shame if somebody decided against using something because they heard about an is…

> people should test out

Why should they, though? The fault here is on its management team. Users and clients lost their trust, for good reasons.

I never used MongoDB, but I know people that got in real trouble due to it.

Re: Was MongoDB Ever the Right Choice?

#207

Earlier quoted context omitted.

I’m a big fan of Mongo for the use case you described - searching by ID and all information in one document. But people don’t seem to understand that there are plenty of scenarios where you really either don’t know the schemes in advance and/or the “schema” is defined by an external source. I worked for a company that sold software that allowed users to create forms that could be filled out either on the web or via a…

PostgreSQL's JSON columns are pretty powerful

And if you create a table with a single ID column and a single JSON column you’ve essentially re-invented a NoSQL database. But I guess you can pretend it isn’t.

Re: Was MongoDB Ever the Right Choice?

#208

Earlier quoted context omitted.

Postgres is not an alternative to Mongo, though. Provide a noSQL alternative if you want an alternative. RDBs and non-RDBs seek to address different sets of problems, and sometimes you do not want or need a relational database.

Postgres has JSON support. In fact Amazon's documentdb which is alternative to Mongo, is built on top of Postgres AFAIK.

Its built ontop of aurora, which is amazons own datastore.

Re: Was MongoDB Ever the Right Choice?

#209

Earlier quoted context omitted.

The Jepsen tests [1] have been run against MongoDB - while older versions presented edge-case opportunities for data loss, that's no longer the case with recent versions. The Jepsen tests also specifically test sharded clusters. From Aphyr's report: > MongoDB 3.6.4’s sharded clusters offer comparable safety to non-sharded deployments. These tests are now integrated into MongoDB's regular test suite. Maybe MongoDB was…

FWIW, the data loss I was referring to happened on a single node. There may have been issues in a distributed environment as well but we never got there.

You are aware that 10gen state clearly that single node is not supported for production deployments. And that a replica set is required.

Re: Was MongoDB Ever the Right Choice?

#210

I would argue that MongoDB is not—and has never been—the best choice for solving any particular technical problem. But it had some other "advantages" over other, better solutions – in that it was easier to set up, didn't require schema definition, had a passable clustering story etc. I have worked with at least one company that had been built using MongoDB as a primary data store from day one. This caused untold pain…

I disagree... I think if you have an application where you have several variants of a type of document in a handful of collections, MongoDB is a great fit (think classifieds, or other storefront). It the structures don't nest too deeply, and they vary a bit from one subtype to another, it can work very well. And scale better in the box than many alternatives (a shortfall of PostgreSQL imho).

It's a combination of factors. I still mostly reach for more traditional SQL options (including SQLite). It just depends on the needs of the application, the costs associated and the skill and experience of the developers working on the application.

I would still reach for Mongo first for a handful of application types, I do wish that RethinkDB had the marketing effort/money/skill that Mongo did, as I think they were more solid on the technology, and the admin interfaces are great. I'd love to see a mid-scale vendor pick up the tech and run with it.

Post reply on HN