4 ms·
Anecdotally: Mongo is great for developing small projects. It's fun to work with since it's got no defined structure, and will just save whatever you give it
by bigethan 15y ago
Anecdotally: Mongo is great for developing small projects. It's fun to work with since it's got no defined structure, and will just save whatever you give it wherever you say to.
That flexibility comes back to haunt it in larger projects. A typo in a query can trigger a reindex of a huge collection, make moot GBs of index data, or invalidate other queries that work on the same collection. It also demands that the devs do lots of documentation on the data structures as you can't ask mongo to tell you it's schema, it's just a collection of documents.
And if you work with a loosely typed language, be sure to type your inserts as mongo is not a loosely typed datastore (coughPHPcough).
But for internal tools, and smaller projects, the speed of development is great.
- bricestacey 15y agoSome ODMs like Mongoid have a strict mode that requires a field to be mapped in order to save it to the db. This saves you from typos wrecking havoc. You should probably unit test your queries anyway.
- gregwebs 15y agoyep, either use an ODM (or some system that guarantees correctness) or make sure your raw queries are well tested.
- FuzzyDunlop 15y agoYeah. Mongoose on Node requires you to code and instantiate a document schema before you can do anything with the database. Gotta sacrifice some flexibility for a bit of safety.
- rbranson 15y ago... and if that wasn't bad enough, then the global locks and mmap'd I/O haunts you later when you have any sort of concurrency or for data>RAM, or the first time you have to take the site down to perform a compaction. Can you tell I've been burned?