It goes to show that HackerNews consensus != reality.
I do wonder where/how Mongo makes their money - if anybody has some insight, please share.
It goes to show that HackerNews consensus != reality.
I do wonder where/how Mongo makes their money - if anybody has some insight, please share.
Edit: Mongo is a special kind of lock-in: your code ends up so much more tightly-coupled, and hard to extricate, because of the Mongo pattern of making you do the work to ensure consistency and correctness. I can’t imagine it was planned, but it’s highly effective: for many companies it’s just too much work, too expensive, and the benefits are too opaque (“but the application works now, and you’re telling me you want to switch databases and it’ll take how long?!”) for others to buy into.
I’d call it clever, but I think it’s a profitable accident that’s a braking force on the progress of many teams.
And it is it not just me and my friends -- HSBC recently announced they are moving 65 of its relational databases to mongodb. I am not sure that is wise, but I think it furthers my view that data-loss is not a concern in many contexts.
The data-loss thing was most certainly real, but has not been since wiredtiger if one manages it the right way or uses it as a service.
I would not say that I would say that HN != reality, maybe !== reality :). Neither side of the debate is wholly right, and neither is wholly wrong.
The reason I use it is that for many projects, all you need is a relatively fast JSON document store, and mongo is so developer-friendly such that speed-to-prototype is so much shorter than anything else I have used in 25 years of building database-backed applications. Rethink was the only product that I would have used in its place and I was extremely sad to see it go. I agree with the commenter elsewhere in the belief that it would have thrived had it survived. I was using it for my personal/learning projects and was ready to switch everywhere.
We have stuck with Mongo in production for a few products, one relatively large, and I think if you have separated your concerns well-enough, it is okay developing in Mongo while leaving yourself a path to postgresql or something else. You need to prove, first, that the thing you are building is useful, and Mongo will let you get to that really fast.
I believe what is happening here is that the happy folks are quiet, and the aggrieved folks' experiences are real but it likely was a bad fit for their particular situation. For the subset of situations where we use it, it has allowed my teams quickly in our experimental work.
All of that said, I work in an innovation space where we throw a lot of things at the wall to see what sticks, and our time-to-prototype is often a few months at most. For us, it has been a godsend, but our situation is rather unique.
-h
The very RAD reasons you note regarding Mongo also encourage Mongo Cancer (tm).
What is Mongo Cancer you ask? It is the phenomena where Mongo use is manifest from API to home-grown "relational logic" in business tier. This simply doesn't happen with any other NoSQL DB afaik, but Mongo Cancer uniquely marches right up to the user's face in the API.
> I think if you have separated your concerns well-enough, it is okay developing in Mongo while leaving yourself a path to postgresql or something else.
I'll hold you to that "I think" and assume you have never actually done this.
Because Mongo Cancer patients typically love the RAD aspect of grabing JSON hot off the http stack and shoving it in the "database", touching every API in the way. The last M.C. project I saw required effectively a rebuild to actually swap the misused Mongo.
tldr; Mongo Cancer is very easy to catch but requires very expensive surgery to cure.
I do not think the "cancer" metaphor is valuable here. What you describe are bad ideas that I agree are bad ideas but really one has to know the tool they are using and what it is bad at.
I think the thing you describe can happen but that is just poor planning more than anything. Why does the database have anything to do with the design of your API layer? That sounds bonkers. And I would not blame the underlying database tech. I would blame the implementer.
But really, please consider that many of us have, or are as we speak, losing loved ones to a deadly sickness which you have compared to a poor database implementation.
> But really, please consider that many of us have, or are as we speak, losing loved ones to a deadly sickness which you have compared to a poor database implementation.
Sorry for your loss. Use of the word for non-medical concerns is common. Mongo Metastasis works too.
Again disagree regarding "poor database implementation". Trivializing the "database implementation" is precisely Mongo's value proposition and the very reason they got their market share.
I would even say the strengths that I have pointed out are precisely what makes it easier to take shortcuts. It gets out of your way, makes collections if they do not exist, allows for different document types in the same collections. It has no guard rails whatsoever.
I think we are in agreement -- one needs to be very careful using this. You can use it and put yourself in a spot where you have to throw out your entire codebase.
Well, me saying "can happen" does not mean it does not happen or that people have not seen it. It is saying the opposite. My point is it does not have to or that it does not always happen.
Developers take shortcuts, often because they do not know better, and you are right that some products make it easier to go down these roads.
I still do not think you want to use medical diseases as metaphors. You would not say "mongo aids" or "mongo alzheimers" or "mongo diabetes." Even if it is common, it is not particularly useful. Metastasis is better.
And back when I started with it, JSONb did not exist. I would say JSONB was also a godsend though as our roadmaps now have a clear path to something we may prefer later. People up the chain are often terrified when they hear the word "mongo" so the existence of JSONB makes it easier to swap out your layer that handles database interactions.
But the speed advantage really lies in the early-stage prototype development. If I have to do it in postgres, the amount of code necessary up front, when inevitable schema changes happen, etc. makes mongo preferable until things settle down.
But again, it all depends on how well you know the thing up front. If you can anticipate a lot of iteration on the data model as you learn how people use your product, mongo is handy early. If I am given a spec for something where all of the things are known and foreseen, I am going with postgresql.
I assume that the hardest thing to do is making something people want to use. If I can achieve that with whatever I use, I have some good (and fun) problems on my hands. And it is all about structuring the work so that I am not tied to any database product. I am no longer working on startups with little-to-no funding, so right now I assume AWS or Azure will manage a database better than I can. And I assume new things are always coming.
> Querying is in pure JS, easy to do stuff programmatically.
You mean you do your logic at the application layer? Like if you need X objects and Y objects where Y have an identifier to the X objects they're related to you build them in JS after retrieving them?
What is the difference from getting a json object and doing the "querying" in pure js?
And isn't it easier "programatically" to just join the data at the source?
> But the speed advantage really lies in the early-stage prototype development. If I have to do it in postgres, the amount of code necessary up front, when inevitable schema changes happen, etc. makes mongo preferable until things settle down.
But again, what is the difference of having a record with a column with json, that you just do rodeo dump?
(I think pg even allows you to do all sorts of indexing on inner fields of json if I'm not mistaken?)
If I want a particular array item nested a few levels in a JSON, the query as JSON object instead of query as an SQL is just a bit easier to put together (which is what i mean by pure JS). Sometimes, putting complex queries together takes fewer lines of code. Neither is really better or worse.
But I want the database doing the work and want to transform as little as possible on the application layer. Sometimes it is inevitable, but sub-optimal, for sure.
In terms of anything where you need to do a lot of joins when querying -- NoSQL is not good and I would not advise Mongo at all. It depends on what you are building. A lot of applications (and even games) now just pass JSONs around. If I show a user profile, I get that json. If, on the profile, I need to show where she lies in a leaderboard, that react component hits a separate API call to get the data needed for it, etc.
But no difference really. And yes, if the JSON is just a column in postgres, even the early stuff is nearly as easy as it is in postgresql.
If I were looking at a DB for a simple key/value store, I would not look at Mongo. Others here likely know better, but I pick up Redis (out of habit, but also it is awesome even if overkill in many scenarios). Mongo would do it but I would not do so except temporarily. I tend to throw Redis in my stacks early in development as I tend to need it later.
BTW by no means do I love Mongo. For example, Mongo is awful when it comes to things simiilar to joining in SQL land. You end up in these hellscapes where there is no choice but to store a ton of redundant data. Is it the end of the world? No, storage is cheap. But is it good? No.
And I am old so I do not find the value in arguing about tools. It is like me hating a hammer. I am interested in what is better and what folks here think about things coming down the pipeline, or whether Arango is worth looking at, etc. But I do appreciate your sort of inquiry as I have learned from it -- for example I did not know you can index inner fields of JSONs. I really need to revisit is as recent versions of PG seem to get better and better.
Context matters a ton. If you are going right to production with something, that is not really where I operate. But in general, as many have said, if more than one thing will do it, the best tool is the one you know best. You are likely to implement it efficiently, etc.
I agree with you on redis-like utilities being better for pure KV stores. If you resort to that sort of thing regularly and want to give another look into postgres you might want to give Elixir a try. It has first class support for postgres with Ecto, and you can use redis-like stores from the language itself, skipping serialization (a note is that, one of the valuable things in redis usually comes from being in a separate instance, many times managed automatically, and so almost being a permanent cache - to have exactly the same properties you would need to dig a bit deeper in Elixir, but still pretty doable with the language building blocks).
Reality!=Market consensus (startups that lost their data using the first versions of mongo)
More often: HN consensus=Reality
At least ES had the decency to tell you it might lose your data.
- Revenue: Total revenue was $150.8 million in the third quarter fiscal 2021, an increase of 38% year-over-year. Subscription revenue was $144.1 million, an increase of 39% year-over-year, and services revenue was $6.7 million, an increase of 19% year-over-year.
- Gross Profit: Gross profit was $104.7 million in the third quarter fiscal 2021, representing a 69% gross margin, compared to 71% in the year-ago period. Non-GAAP gross profit was $108.6 million, representing a 72% non-GAAP gross margin.
- Loss from Operations: Loss from operations was $58.1 million in the third quarter fiscal 2021, compared to $38.7 million in the year-ago period. Non-GAAP loss from operations was $16.0 million, compared to $14.3 million in the year-ago period.
- Net Loss: Net loss was $72.7 million, or $1.22 per share, based on 59.4 million weighted-average shares outstanding in the third quarter fiscal 2021. This compares to $42.4 million, or $0.75 per share, based on 56.4 million weighted-average shares outstanding, in the year-ago period. Non-GAAP net loss was $18.2 million or $0.31 per share. This compares to $14.6 million, or $0.26 per share, in the year-ago period.
- Cash Flow: As of October 31, 2020, MongoDB had $966.8 million in cash, cash equivalents, short-term investments and restricted cash. During the three months ended October 31, 2020, MongoDB used $8.1 million of cash from operations, $5.6 million in capital expenditures and $1.2 million in principal repayments of finance leases, leading to negative free cash flow of $14.9 million, compared to negative free cash flow of $13.1 million in the year-ago period.
For a dedicated database that has 32 GB of RAM, 8 virtualised CPUs, and only 160GB of storage you will pay $2 an hour! That's $17,520 a year for a database with the same level of compute and far less storage than my laptop.
I realise a big part of their target market is firms who are convinced they either can't hire skilled sysadmins or are convinced their time is worth more than the US President but at $17,520/yr for a tiny database it only takes two or three of those before you could, in fact, hire a full time sysadmin in a cheap location. And there's no way that maintaining these things would require an FTE, it's not even close to being a full time job. So how do the economics of this work out? Can anyone explain to me?
My best guess is that Atlas customers are companies that are totally price insensitive and have some sort of "everything must be cloud managed without exception" rule imposed from the top down. As Mongo is licensed such that only they can run a hosted service, such customers would find themselves forced by internal policy into paying whatever price Atlas charges. This would also explain their very low services revenue. But I don't know that, it's just a guess.
Idk, but maybe the engineers don't fully trust it, so they outsource the liability of running it with some contractual guarantees. And at the moment, this probably looks more fashionable, so no one dares question it in fear of seeming backwards.
Its not a contradiction to dislike mongodb technically well still thinking its a good business.