[SERVER-6637] Make find(...).remove() work Created: 29/Jul/12  Updated: 17/Jul/20  Resolved: 17/Jul/20

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

Type: New Feature Priority: Minor - P4
Reporter: David K. Storrs Assignee: DO NOT USE - Backlog - Platform Team
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

I frequently find myself repeating this workflow:

  • do a find() to locate a set of documents
  • edit that 'find()' into a 'remove()'

It would be convenient if I could simply append '.remove()' to the end of the cursor and have it understand what that means.



 Comments   
Comment by Jessica Sigafoos [ 17/Jul/20 ]

This is usecase is not being prioritized in the new shell implementation.

Comment by David K. Storrs [ 07/Aug/12 ]

Why is this not possible? Have a cursor+remove reduce to a series of
N since-object remove commands, the same way things in the oplog which
touched multiple docs may decompose to a series of single-item
commands.

Dave

On Sun, Jul 29, 2012 at 6:50 AM, Scott Hernandez (JIRA)

Comment by Scott Hernandez (Inactive) [ 29/Jul/12 ]

David, there are many options you can use on a cursor (find) which aren't possible with remove so it may be a little mislead, and confusing to allow this construction.

It would make more sense if other features were implemented first, like allowing a limit/skip on remove: SERVER-4796

db.coll.find(...).sort(...).limit(10).remove() // not supported (logically)
 

Do you return an error from remove, or just ignore the sort/limit – and then when sort/limit is supported on the server should the client detect that the server supports that or be limited by the code in the client version?

Generated at Thu Feb 08 03:12:16 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.