Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. COI don't see why the compare-and-swap as I've proposed would fail under replication but not in single-server. The key point in my suggestion is that you only write if the version hasn't changed from when you began editing it (i.e. in a web form), and let the user decide what to do if it has been modified (or otherwise manage the conflict). In single-server, you can still have multiple users, so conflicts can happen in both scenarios.
      singulars
    2. COIf you allow *unsafe reads* (i.e. reads from secondaries), the version read might not be up-to-date. In that scenario, the client believes the current version is, say 12, but the master has already seen a write, increasing the version to 13. Now the update would fail because we read from a secondary. This can't happen in single-server, and it can't happen when reading only from the master. The modifier operation would still execute, but might not give the expected result, because the older version is different from what was displayed to the user.
      singulars
    3. COIt can happen in single-server scenarios (or when not reading from secondaries) if another user updates the document between when a user reads a version (12 in your example) and when they try to write (i.e. on web page submission). In other words, build the code to expect conflicts and handle them appropriately (which is an application specific concern; you're right that MongoDB doesn't handle this for you in any way).
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload