[SERVER-1744] renameCollection "to" param as an array Created: 06/Sep/10 Updated: 06/Dec/22 Resolved: 11/Aug/17 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Write Ops |
| Affects Version/s: | 1.7.0 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | Scott Hernandez (Inactive) | Assignee: | Backlog - Query Team (Inactive) |
| Resolution: | Won't Fix | Votes: | 2 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Assigned Teams: |
Query
|
||||||||
| Participants: | |||||||||
| Description |
|
Change renameCollection to support an array of collection names as the destination(s) so that you don't delete the destination collection. That would support a primary collection with some postfix value (like a number) of "archived" collections. You could do something like this: {renameCollection:'log", to:["log.1", "log.2"]}(much like log rotation) Maybe this would be better as a new command called "moveCollection". |
| Comments |
| Comment by Eliot Horowitz (Inactive) [ 07/Sep/10 ] |
|
Cursors are invalidated. This is the kind of stuff db.eval is intended for. |
| Comment by Scott Hernandez (Inactive) [ 07/Sep/10 ] |
|
That is just one example. It seems more compelling than my need to basically swap two collections. I want this change: coll.new -> coll -> coll.old (where only coll.new and coll exist at the beginning) You are correct, I could do something with an eval. Does renameCollection currently invalidate cursors on those collections? |
| Comment by Eliot Horowitz (Inactive) [ 07/Sep/10 ] |
|
will leave open to see if its common |
| Comment by Eliot Horowitz (Inactive) [ 07/Sep/10 ] |
|
I see, that might be a bit too specific. db.eval( function(){ |
| Comment by Scott Hernandez (Inactive) [ 07/Sep/10 ] |
|
log -> log.1 |
| Comment by Eliot Horowitz (Inactive) [ 07/Sep/10 ] |
|
Have to admit I don't understand what you're asking for. do |