lightbringer
lightbringer

Reputation: 409

What is meant by atomicity of write operations in MongoDB?

In MongoDB documentation it states that write operations are atomic at the document level. What does this mean?

https://docs.mongodb.com/manual/core/data-modeling-introduction/

Upvotes: 5

Views: 2331

Answers (1)

Sergio Tulentsev
Sergio Tulentsev

Reputation: 230336

It means that you can't have atomic operations that span several documents.

Money transfer, for example. You deduct funds from one wallet, add to another. You can't do that atomically in mongodb.

In case you didn't know what "atomically" means, it is "operation either succeeds as a whole or fails as a whole. It can't have only some parts of it succeed and others fail".

Upvotes: 5

Related Questions