8 ms·
It's almost like the commenters who are bashing the author of the post did not read the bit in bold, which is his main point: If you tell a database to store s
by daveungerer 14y ago
It's almost like the commenters who are bashing the author of the post did not read the bit in bold, which is his main point:
If you tell a database to store something, and it doesn’t complain, you should safely assume that it was stored.
This has nothing to do with the 2Gb limitation. Nowhere in the documentation does it mention that it will silently discard your data. What will happen with the 64-bit version if you run out of disk space, more silently discarded data?
I know a lot of you may have cut your teeth on MySQL which, in its default configuration, will happily truncate your strings if they are bigger than a column. Guess what? Anyone serious about databases does not consider MySQL to be a proper database with those defaults. And with this, neither is MongoDB, though it may have its uses if you don't need to be absolutely certain that your data is stored.
EDIT: Thanks for pointing out getLastError. My point still stands, since guaranteed persistence is optional rather than the default. In fact, reading more of the docs points out that some drivers can call getLastError by default to ensure persistence. That means that MongoDB + Driver X can be considered a database, but not MongoDB on its own.
I'm just struggling to imagine being willing to lose some amount of data purely for the sake of performance, so philosophically it's not a database unless you force it to be. Much like MySQL.
EDIT2: Not trying to be snarky here, but I would love to hear about datasets people have where missing random data would not be an issue. I'm serious, just want to know what the use case is that MongoDB's default behaviour was designed for.
EDIT3: (Seriously) I'm sure MongoDB works splendidly when you setup your driver to ensure that a certain numbers of servers will confirm receipt of the data (if your driver supports such an option), nowhere am I disputing that. But that number really should have a lower bound of 1, enforced by MongoDB itself. And to the guy who called me stupid: you are what's wrong with HN.
- ceejayoz 14y ago> Nowhere in the documentation does it mention that it will silently discard your data. Demonstrably false. http://www.mongodb.org/display/DOCS/getLastError+Command http://www.mongodb.org/display/DOCS/getLastError+Command "MongoDB does not wait for a response by default when writing to the database. Use the getLastError command to ensure that operations have succeeded."
- diminoten 14y agoIt blows my mind that you'd have to post this at all. Who's writing to mongo without making sure the write succeeded?
- DanWaterworth 14y agoPeople who assume such trivialities would be handled for them like in every other DBMS.
- taligent 14y agoOnly inept developers would assume that. EVERY database call should be wrapped in exception handling to make sure that any errors e.g. connection errors are handled appropriately. MongoDB is no different in this case.
- DanWaterworth 14y agoOnly inept developers would assume MongoDB behaves like a DBMS? You can only handle the errors that you know how to handle, in this case retrying the operation may have created a bigger problem.
- diminoten 14y agoOnly people who don't read the instructions for what they're using would get bitten by this. It's like, literally, right there in the brief manual. Takes an hour to read and understand.
- olalonde 14y agoThe people over at MongoDB who wrote the tutorial? http://api.mongodb.org/wiki/current/Ruby%20Tutorial.html#RubyTutorial-InsertingaDocument http://api.mongodb.org/wiki/current/Ruby%20Tutorial.html#Rub...
- 14y ago
- macaroniHeadset 14y agoit's called getLastError
- eranation 14y agoSo, they do return an error, just not throw an exception. Isn't that what people most like/hate about Golang?
- bingaling 14y ago<inappropriate-extrapolation>Can /dev/null + /bin/yes be considered a database?</inappropriate-extrapolation>
- makmanalp 14y agotongue-in-cheek: http://www.youtube.com/watch?v=b2F-DItXtZs http://www.youtube.com/watch?v=b2F-DItXtZs
- Jare 14y agoIf a link to "Write Concern" prominently visible at the start of the first page of the official documentation for the Ruby API does not seem important enough to look at, I don't know what to tell you, except RTFM. http://api.mongodb.org/ruby/1.7.0/ http://api.mongodb.org/ruby/1.7.0/ 'Success' and 'Failure' are fuzzy concepts when writing to distributed databases, and you need to tell Mongo which particular definition fits your needs. The 'unsafe' default in mongo is controversial, but ranting about what a "proper database" is without even reading the docs is stupid. Instead, let's rant about what a "proper developer" should do when using a new system...
- eduardordm 14y ago"I'm just struggling to imagine being willing to lose some amount of data purely for the sake of performance...". A foursquare check-in database could be an example where performance is actually way more valuable than consistency. (I have no idea what database they use)
- omni 14y agoThey use Mongo. http://www.10gen.com/customers/foursquare http://www.10gen.com/customers/foursquare
- lmm 14y ago>I know a lot of you may have cut your teeth on MySQL which, in its default configuration, will happily truncate your strings if they are bigger than a column. Guess what? Anyone serious about databases does not consider MySQL to be a proper database with those defaults. And with this, neither is MongoDB, though it may have its uses if you don't need to be absolutely certain that your data is stored. Nice ad homien there. MongoDB isn't DB2, just as MySQL wasn't. Both can still be used to build very good products; in fact, I'd go so far as to say they lead to better products than "proper" databases.
- pnathan 14y agoI've usually used pymongo [1] for my API docs, and I don't believe I've ever seen this limitation listed there. I also rummaged around the admin area of the mongodb site and don't recall seeing the limitation there. I'm really glad I haven't deployed mongo now in a production 32-bit system. Response to EDIT2: Where can data loss be acceptable? If you are having a relatively speedy message system where messages are removed/outdated on rx. I'm sure there are other specialty needs. [1] http://api.mongodb.org/python/current/ http://api.mongodb.org/python/current/
- rogerbinns 14y agoFor pymongo there is a "safe" parameter you can apply to operations or the connection as a whole. 10gen made a really stupid default decision here. Instead of calling it safe they should have called it async, and it should have defaulted to off. So by default Mongo write operations are asynchronous and you have to explicitly ask for error codes later.