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

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

    • Type: Icon: New Feature New Feature
    • Resolution: Duplicate
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • None
    • Environment:
      Linux, Mongo 2.0.6, 3 shards (each in replica set with 2 machines and 1 arbiter)
    • Query

      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"),
      }

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

              Created:
              Updated:
              Resolved: