Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-6025

Similar mysql syntax "INSERT ... SELECT ..." for sharded collection.

    XMLWordPrintable

Details

    • New Feature
    • Status: Closed
    • Minor - P4
    • Resolution: Duplicate
    • None
    • None
    • None
    • Linux, Mongo 2.0.6, 3 shards (each in replica set with 2 machines and 1 arbiter)
    • Query

    Description

      I can not find similar mysql syntax "INSERT ... SELECT ..." in mongo for sharded collection.

      db.eval() - does not work on sharded collection
      MapReduce - too expensive and slow operation

      Use case:
      Need select documents from one sharded collection, make rearrangement of fields and upsert it to another sharded collection.
      Source collection format:
      {
      "_id": ObjectId("4fcf7349d144ad591c016534"),
      "sid": 111,
      "uh": "www.site.kz",
      "cid": "4facd5427701a",
      "ses": "4fcf7278f1f19",
      "ip": NumberInt(1597732605),
      "t": ISODate("2012-06-06T15: 08: 40.0Z"),
      ...
      }
      Destination collection format:
      {
      "_id":

      {sid: 111, ses:"4fcf7278f1f19"}

      ,
      "t": ISODate("2012-06-06T15: 08: 40.0Z"),
      }

      Attachments

        Issue Links

          Activity

            People

              backlog-server-query Backlog - Query Team (Inactive)
              nodkz Pavel Chertorogov
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: