Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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?

share|improve this question
    
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

1 Answer 1

up vote 0 down vote accepted

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/

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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