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

deleted scope doesn't work for embedded Paranoia

    • Type: Icon: Task Task
    • Resolution: Done
    • 3.0.10
    • Affects Version/s: None
    • Component/s: None
    • Labels:

      tested on 3.0.6. this worked in 2.x

      (rdb:1) p Parent.count
      1
      (rdb:1) p Mongoid.default_session["parents"].find().count
      1
      # this parent has two kids, one deleted
      (rdb:1) p Parent.first.kids.count
      1
      (rdb:1) p Parent.first.kids.unscoped.count
      2
      # but the deleted scope doesn't work
      (rdb:1) p Parent.first.kids.deleted.count
      0
      # the deleted_at date is in the database though
      (rdb:1) p Mongoid.default_session["parents"].find("kids.deleted_at" => {"$ne" => nil}).count()
      1
      (rdb:1) p Mongoid.default_session["parents"].find("kids.deleted_at" => {"$ne" => nil}).first["deleted_at"]
      2012-10-09 02:36:12 UTC
      

            Assignee:
            durran Durran Jordan
            Reporter:
            nader Nader Akhnoukh
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: