Core Server
  1. Core Server
  2. SERVER-3215

Anonymous Garbage Collected/Temporary Collection

    Details

    • Backport:
      No
    • # Replies:
      2
    • Last comment by Customer:
      true

      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.

        Issue Links

          Activity

          Hide
          SlugFiller
          added a comment -

          This is necessary for any large aggregation. Imagine the MySQL equivalent:
          SELECT * FROM a INNER JOIN b ON (b.key=a.b_key) INNER JOIN c ON (c.key=a.c_key) INNER JOIN d ON (d.key=c.d_key) WHERE a.type='stuff_type' ORDER BY a.stuff, b.stuff, c.stuff LIMIT 5000, 20
          In the above case, MySQL creates a temporary table including the (quite large) result set, sorts in on-disk, and then returns the result's subset.

          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.

          Show
          SlugFiller
          added a comment - This is necessary for any large aggregation. Imagine the MySQL equivalent: SELECT * FROM a INNER JOIN b ON (b.key=a.b_key) INNER JOIN c ON (c.key=a.c_key) INNER JOIN d ON (d.key=c.d_key) WHERE a.type='stuff_type' ORDER BY a.stuff, b.stuff, c.stuff LIMIT 5000, 20 In the above case, MySQL creates a temporary table including the (quite large) result set, sorts in on-disk, and then returns the result's subset. 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.
          Hide
          Ilya Shaisultanov
          added a comment -

          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.

          Show
          Ilya Shaisultanov
          added a comment - 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.

            People

            • Votes:
              5 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Days since reply:
                28 weeks, 1 day ago
                Date of 1st Reply: