In association with heise online

28 November 2012, 16:31

MongoDB to report write errors by default from now on

  • Twitter
  • Facebook
  • submit to slashdot
  • StumbleUpon
  • submit to reddit

MongoDB The developers of MongoDB at 10gen have announced that they are making MongoDB's APIs report failed writes by default. The previous default behaviour of the open source NoSQL database had been to return from API calls as soon as possible, without reporting errors, because the design of MongoDB was predicated on the API working with an HTTP-based web server and a pattern was developed of checking for write errors for an entire page being loaded.

Over time though, the web API was joined by Java, Ruby, Python and PHP drivers which used the same protocol as the original system. This meant that developers who were new to Mongo, not realising that they had to check errors, would write to the database and when it stopped doing those writes, for example when the server was out of memory, they would not be notified and the data would be silently discarded. Users could always set WriteConcern in their calls, but they would have to know about it.

The new default will be to set WriteConcern to 1, which waits for acknowledgement from the server but does not wait for secondary servers to replicate the data. Such a change could, however, have major ramifications for existing MongoDB applications – to alleviate this, the old Mongo connection class will not set the new default, but users will be asked to use a new MongoClient connection class which does set the WriteConcern. The older Mongo connection will become deprecated, but is expected to "remain for quite a while (but not forever)". Users wanting the old behaviour with the new connection class will have to set WriteConcern to 0 for all their calls.

(djwm)

Print Version | Send by email | Permalink: http://h-online.com/-1758693
 


  • July's Community Calendar





The H Open

The H Security

The H Developer

The H Internet Toolkit