Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-365

remove() via _id does not remove multiple objects

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.1.3
    • Affects Version/s: 1.1.1
    • Component/s: None
    • None
    • Environment:
      Linux

      remove({_id: {$lt: some_value}}) only removes one element, but remove({other_field: {$lt: some_value}}) removes all matching elements:
      > db.testme.save({_id:1, _o:1})
      > db.testme.save({_id:2, _o:2})
      > db.testme.save({_id:3, _o:3})
      > db.testme.save({_id:4, _o:4})
      > db.testme.save({_id:5, _o:5})
      > db.testme.remove({_id: {$lt: 4}})
      > db.testme.find()

      {"_id" : 2 , "_o" : 2} {"_id" : 3 , "_o" : 3} {"_id" : 4 , "_o" : 4} {"_id" : 5 , "_o" : 5}

      > db.testme.remove({_o: {$lt: 4}})
      > db.testme.find()

      {"_id" : 4 , "_o" : 4} {"_id" : 5 , "_o" : 5}

            Assignee:
            eliot Eliot Horowitz (Inactive)
            Reporter:
            grmblfrz Swen Thümmler
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: