[SERVER-3215] Anonymous Garbage Collected/Temporary Collection Created: 07/Jun/11 Updated: 06/Dec/22 Resolved: 25/Mar/19 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Usability |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Minor - P4 |
| Reporter: | Moses Nakamura | Assignee: | Backlog - Query Team (Inactive) |
| Resolution: | Done | Votes: | 10 |
| Labels: | collection | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Assigned Teams: |
Query
|
||||||||
| Participants: | |||||||||
| Description |
|
It would be useful to be able to create temporary anonymous collections, in order to fake big transactions. Right now (in java) I am using the hack of running a .find() on a new collection that I make, and then a .toArray() on the cursor that is returned, and then inserting the resulting list to my main collection. Then I drop my collection. But even if I forgot to drop the collection, it would be nice for it to disappear. Also, it is annoying to have to generate a random string to support multithreading this. |
| Comments |
| Comment by Craig Homa [ 25/Mar/19 ] |
|
We believe that the aggregation $out feature supports this. |
| Comment by Asya Kamsky [ 05/Dec/17 ] |
|
Aggregation has supported $out option which may be used for this since version 2.6. |
| Comment by Ilya Shaisultanov [ 04/Oct/13 ] |
|
This would be very useful for containing intermediate states/operations which then go to the final collection. I'm researching right now how to do that manually because that's something we have to do. |
| Comment by SlugFiller [ 21/Jun/12 ] |
|
This is necessary for any large aggregation. Imagine the MySQL equivalent: In Mongo, since there is no join, such a query can and should be done using many smaller queries which take the original subset, and adds the necessary information, sorts the resulting information, and finally returns the required subset. However, unless the table/collection "a" is small enough to be fully contained in memory (which it usually isn't), a temporary collection must be formed in order to hold the result set prior to extracting the required subset. |