2

I have heard that Mongo has something like phantom writes. For example, if I have a web request with the following db commands in a single unit of work:

a) update comments in article
b) update article attributes
c) update users comment_field

Questions:

  1. Is it possible that only a and c execute, and b fails or never gets to the database?
  2. Is it possible that only a and b execute, and c fails or never gets to the database?

Where can I read some more in regards to this, or is it just a myth?

  • I'm not a Mongo person, but per their docs atomicity is only guaranteed within a single document. If you have operations on multiple documents one set can fail and another can succeed. – JNK May 7 '13 at 16:41
  • 5
    Lack of transactions and lack of consistency are two of the things that separate NoSQL solutions from RDBMS - it's a lot faster to write with high concurrency if you have looser controls on the data. – JNK May 7 '13 at 16:42
  • 3
    Would it be inappropriate for me to throw in an observation along the lines of "Who needs consistency, MongoDB is web scale!"? – Mark Storey-Smith May 7 '13 at 22:29
  • Ha ha...great video. I wasn't aware that data is not written into the database just put in a "queue"-ish. Thx – Kamilski81 May 9 '13 at 15:36
0

Just to answer my question, in case people come across it:

1) Yes, it is possible for A, and C to be committed and B to fail. Atomicity only exists on documents in MongoDB. 2) Yes, this is possible as well.

See more for reading here:

http://docs.mongodb.org/manual/tutorial/isolate-sequence-of-operations/

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.