[SERVER-365] remove() via _id does not remove multiple objects Created: 16/Oct/09  Updated: 12/Jul/16  Resolved: 16/Oct/09

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 1.1.1
Fix Version/s: 1.1.3

Type: Bug Priority: Minor - P4
Reporter: Swen Thümmler Assignee: Eliot Horowitz (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Linux


Participants:

 Description   

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}

 Comments   
Comment by Eliot Horowitz (Inactive) [ 16/Oct/09 ]

jstests/remove3.js

Generated at Thu Feb 08 02:53:51 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.