multi update finishes before changes are actually made

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • 12_01_17
    • Affects Version/s: 1.1.5
    • Component/s: None
    • None
    • Environment:
      mongo 1.6.3 replica set on centos running on rails with http://github.com/fortnightlabs/mongoid
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      I have a collection with a few 100k records on a replica set.

      When I update all records to set :send_weekly_emails => false:

      Person.collection.update({}, { '$set' => { :send_weekly_emails => false }}, { :multi => true })

      Then I query (in a separate rails console) to see if things have gone through and it takes several minutes before all of the people have the flag set to false.

      > Person.where(:send_weekly_emails => true).count # => 56
      > Person.where(:send_weekly_emails => true).count # => 38
      > Person.where(:send_weekly_emails => true).count # => 37
      > Person.where(:send_weekly_emails => true).count # => 2
      > Person.where(:send_weekly_emails => true).count # => 2
      > Person.where(:send_weekly_emails => true).count # => 2
      > Person.where(:send_weekly_emails => true).count # => 2
      > Person.where(:send_weekly_emails => true).count # => 0

      Isn't the multi update supposed to be atomic? If anything, I would not expect it to finish before the changes were actually persisted to the replica set.

      Note: the send_weeky_emails field is not indexed.

            Assignee:
            Kyle Banker (Inactive)
            Reporter:
            Gerad Suyderhoud
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: