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

delete_all on STI models

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 6.1.1
    • Affects Version/s: None
    • Component/s: None

      STI delete_all works fine on 2 layers STI

      class P
        include Mongoid::Document
      end
      
      class C < P
      end
      
      > P.delete_all  #   MOPED: 127.0.0.1:27017 DELETE       database=xxx_development collection=ps selector={} flags=[]
      

      but some problem occurred on 3 layers STI

      class GF
        include Mongoid::Document
      end
      
      class P < GF
      end
      
      class C < P
      end
      
      > P.delete_all  #    MOPED: 127.0.0.1:27017 DELETE       database=xxx_development collection=gfs selector={:_type=>"P"} flags=[]
      

      Invoking P.delete_all only delete all documents of type P but I would like to delete all documents of type P and C
      Is this issue by design or bug ?

            Assignee:
            emily.stolfo Emily Stolfo
            Reporter:
            chenghung chenghung
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: