Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-3038

Atomic characteristic of update $modifiers should be more explicit

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • v1.3.12
    • Affects Version/s: None
    • Component/s: manual
    • Labels:
      None

      The fact $inc (and other) is atomic is difficult to establish from the current documentation. $inc reference page does not mention it.

      Searching for "atomic" only returns a page with a findAndModify example.

      15:28 < ragezor> hello guys, i'm trying to implement a counter system in mongodb and i need advice about implementation
      15:28 < ragezor> i have a collection counters and in there a lot of documents which represent one counter each
      15:29 < Nodex> so far so good
      15:29 < ragezor> counters have field number which then i increment each time an event occurs
      15:29 < ragezor> my question is
      15:29 < ragezor> if many different processes are incrementing the counter
      15:30 < kali> if you're using $inc:1, it will work as you want it to work
      15:30 < ragezor> can it happen that counter breaks, that is some increments are not registered?
      15:31 < ragezor> so $inc is atomic operation?
      15:31 < kali> yes
      15:31 < ragezor> ok, cool

            Assignee:
            andrew.aldridge@mongodb.com Andrew Aldridge
            Reporter:
            kali Mathieu Poumeyrol
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              9 years, 29 weeks, 4 days ago