Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-4477

Wrong accounting in contextual delete method

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 7.0.0, 6.4.0
    • Affects Version/s: 5.2.1, 6.2.1
    • Component/s: None
    • None
    • Environment:
      OS: Debian stretch
      Mongo: 3.2.11

      I've noticed that the contextual delete method is always returning 0 when write concern is set to 0.

      Destroy on the other hand, correctly accounts the number of destroyed records with write concern set to either value (1, 0).

      Both of those methods specify the return value as `nil` in their respective comments.
      @return [ nil ] Nil.

      Bisecting the issue reveals that this behavior affects all versions >= 5.2.0.
      https://github.com/mongodb/mongoid/commit/c24acdb0c8ce52591176bd7af6bb454025628c58

            Assignee:
            emily.stolfo Emily Stolfo
            Reporter:
            kolokithas.b billk
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: