Live data from Hacker News

MongoDB queries don’t always return all matching documents

engineering.meteor.com

201–210 of 419 posts

Re: MongoDB queries don’t always return all matching documents

#201

Earlier quoted context omitted.

The HN crowd tends to insult it, but outside of HN people hype it up. People keep talking about how much they love the MEAN stack. It's huge in the hackathon crowd, due to them sponsoring many of them, and its low learning curve. I wish people would stop using acronyms and realize Express/Angular/Node is just as good with something other than Mongo.

I can confirm. On HN, meetups, Twitter, etc. no one talks about MEAN stack any more because of Mongo and the Angular 1/2 split (and React's popularity). In the last hackathon I went to, like most "corporate sponsored" ones, you got a special prize for using it.

Are people using React starter kits? The major issue I'd see with React at hackathons is the large amount of configuration you typically need to do before you get started. I dislike starter kits due to the additional complexity overhead, but I can imagine for a throwaway project they'd be fine.

Re: MongoDB queries don’t always return all matching documents

#203
The real problem with Mongo is that it's so enjoyable to start a project with that it's easy to look for ways to continue using it even when Mongo's problems start surfacing. I'll never forget how many problems my team ended up facing with Mongo. Missing inserts, slow queries with only a few hundred records, document size limits. All while Mongo was paraded as web scale in talks.

Re: MongoDB queries don’t always return all matching documents

#204
> 1) Have migrations (except they're going to be some scary ad hoc nodejs script that loop through your document store and modify fields on the fly).

Unless you have never written migrations in SQL before you would know that they are even scary and a big bunch of sql. What is even worse is that, despite nobody here acknowledging it, must SQL databases are used with an ORM. Now in your migration script you have to hack SQL and language-based ORM commands together into a big pile of shit.

> 2) Have schemas (except they'll be implicit and undocumented)

Actually they can be just as explicit and documented. Mongo even has schemas now I think. But you can see the schema in the class definitions of your code. Once again, most people use an ORM and do this anyway.

> 3) Constraints (except they'll be hidden inside your app logic, and violating them will cause data corruption).

Errr... SQL constraints are very limited and literally every application has additional constrains embedded in the code.

The PostgresSQL propaganda on this forum is such bullshit. None of you have any idea what you are talking about even though you are supposed to be hackers.

Re: MongoDB queries don’t always return all matching documents

#205

Earlier quoted context omitted.

I've been in the opposite situation and I couldn't disagree more. But I will say this, it's always possible to take an RDBMS model and de-normalize it and use it like a NoSQL database (like reddit does, for example) but it's not possible to go the other way.

> but it's not possible to go the other way Why not? We do exactly that. We prototype in mongo and then migrate to postgres when we're comfortable with where the app is headed.

I don't mean it's possible to use a different technology; I mean within the same technology (postgres, for example) you can use it both as a normalized relational database and/or as a de-normalized document store.

Re: MongoDB queries don’t always return all matching documents

#206
post #9

Earlier quoted context omitted.

> don't use mongo, it's just hype I'm kind of curious as to where this hype is. I've almost never heard anybody say anything positive about mongodb. All I ever see is people saying it's terrible / hilarious for various reasons.

Like with any online community, Hacker News can be kind of an echo chamber where groupthink reigns and alternative points of view aren't encouraged. MongoDB hype has died down here, but there are still some people that are fans. There are some things MongoDB does fairly well: * MongoDB is really easy to use * Document databases can be great and flexible solutions for some kinds of projects * Documentation is fairly g…

> scales fairly well at the initial stages

Not sure what that means, but scalability is the worst thing about mongo (though my experience with mongo is all from ~2.5 ish years ago). As soon as your working set of indices gets bigger than memory, performance falls off a cliff and your entire app grinds to a halt. In my experience, mysql and postgres have a more gradual decline in performance so you have some time with only mildly degraded performance to figure out a solution (plus they have more options for tuning which can buy you more time).

Re: MongoDB queries don’t always return all matching documents

#207
post #8
post #6

What storage engine are you using? I wonder if the same issue comes in wiredtiger MVCC engine.

He wrote in comments that this issue is in mmap and in wiredtiger.

There are like 5+ storage engines available for Mongo, probably more, but those are just the ones I'm aware of, plus various forks, like TokuMX an Percona, etc... This is all FUD.

Re: MongoDB queries don’t always return all matching documents

#208
post #124

Earlier quoted context omitted.

> Why on earth would you use a database that makes so little in the way of guarantees about what results you get from it? Because some people can't stand having to work with SQL,migrations,schema and constraints, it's as simple as that ( That's not my opinion,that's just the rational behind MongoDB). Even if you use Postgres with the Json column type, you still need to write SQL queries and schemas. In the context of…

> Because some people can't stand having to work with SQL,migrations,schema and constraints The thing is, if you actually try and write an app using MongoDB, you will rapidly find that you: 1) Have migrations (except they're going to be some scary ad hoc nodejs script that loop through your document store and modify fields on the fly). 2) Have schemas (except they'll be implicit and undocumented) 3) Constraints (exce…

Mongo has its weaknesses, yes its main strength is cited as its simplicity, or that its quick to get something out the door.

I agree with your last comment. I can't help but to laugh at people who think they would get away with designing a database with no schema. Schemaless for me meant that unless you enforce constraints, there won't be any.

There's a reason why there are ORMs even though Mongo drivers are sufficient for most cases.

1) I've always designed my data with future changes in mind. I often spend up to an hour thinking of possibilities of data that I want to store in a collection, before writing the schema. The flexibility i have with Mongo is that if I think I need a field but am unsure of the exact data type to store, i.e. is it a string or array of strings, or array of objects with strings? In that case I just leave the field as an object and change it later. The plus being that as long as I haven't stored anything with that field, I can always change its type without a 'migration script'.

I've only needed to 'migrate' by updating documents 4-5 time. When GeoJSON landed, and a few other times when I needed small changes to my data.

3) The only way I can think of enforcing constraints on I've used MongoDB primarily for its Geo support, and JSON enabling me to get things done quicker relative to maintaining SQL tables. I've got a small but interesting use case, public transit. https://movinggauteng.co.za and https://rwt.to.

When I started with the projects, PostgreSQL + PostGIS felt like a black box, and I wanted something that would give me ease and flexibility. At the time hstore was the talk of the day, but seemed to not meet my needs.

It would now with JSON, but I'll stick with Mongo for now.

Re: MongoDB queries don’t always return all matching documents

#209

> 1) Have migrations (except they're going to be some scary ad hoc nodejs script that loop through your document store and modify fields on the fly). Unless you have never written migrations in SQL before you would know that they are even scary and a big bunch of sql. What is even worse is that, despite nobody here acknowledging it, must SQL databases are used with an ORM. Now in your migration script you have to hac…

I've just commented with pretty much the same as you're saying.

Some people sound like they haven't even tried Mongo.

It's great that PG has JSON support now, but a few years ago people were having together stuff on hstore, storing their geo objects as binary blobs that you can't read without extensions etc.

SQL databases have been playing catch up with JSON, MSSQL being the worst. Even with JSON support, it's still a pain looking at some SQL queries that have to be written.

If postgres does it for you, don't go bashing everything else that tries to be an alternative I feel.

Re: MongoDB queries don’t always return all matching documents

#210

> 1) Have migrations (except they're going to be some scary ad hoc nodejs script that loop through your document store and modify fields on the fly). Unless you have never written migrations in SQL before you would know that they are even scary and a big bunch of sql. What is even worse is that, despite nobody here acknowledging it, must SQL databases are used with an ORM. Now in your migration script you have to hac…

[deleted]
Post reply on HN