5 ms·
I used it for exactly one production app and it was a huge success. The reason I used it was because the data we needed to represent was actually a document, in
by chadcf 13y ago
I used it for exactly one production app and it was a huge success. The reason I used it was because the data we needed to represent was actually a document, in this case a representation of fillable form fields in a pdf document. The basic structure was that documents had sections and sections had fields and fields had values, types, formatters, options, etc.
Initially trying to come up with a schema in SQL was somewhat painful as what I was really looking for was an object store. Switching to mongo gave me a way to do a very clean, simple solution that worked quite well for the problem at hand (representing pdf forms). That said, we also played it very safe and used mongo for only the document portion, with every other part of the system being in an sql database. But for the doucuments mongo worked really well as a basic object store without the complexity of something like Neo4j.
- idProQuo 13y agoFor all the talk about how "MongoDB totally has SOME use cases", I've never before heard of a use case where it would be unambiguously better to use a document store. Thanks for explaining that so well.
- tensor 13y agoOf course, a better choice now would be to use PostgreSQL's new JSON support. Postgres has also had XML document types for a long time, though I'm not sure of their indexing story. If you don't need indexing into the document, you can easily just store it as serialized bytea data. I've done this quite frequently and it works wonderfully.
- threeseed 13y agoSorry but PostgreSQL's JSON query syntax is insanely complicated compared to MongoDB. And that is a big deal for a lot of developers.
- tensor 13y agoI just took a look, and if I'm getting this right, it looks about as simple as it gets: SELECT json_data FROM people WHERE json_data->'age' > 15 vs db.people.find( { age: { $gt: 10 } } ) Personally, I prefer the postgres syntax. It's much clearer. I also don't buy your claims below about performance. Can you provide a real benchmark? Are you running with the safeties off meaning you lose data?
- dbcfd 13y agoWhat is the syntax on finding an array value matching some key? E.g. given a user with field "favFoods":[String], how do I determine that pizza is in there?
- jessedhillon 13y agoselect ... where "pizza" in person -> favFoods
- jessedhillon 13y agoSorry I'm stupid, I was thinking Python select ... where person -> favFood in ("pizza")
- gfodor 13y agoYour ORM will give you whatever syntax is natural, eventually.