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

$out fails with duplicate _id key error

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.6.2
    • Component/s: Aggregation Framework
    • Labels:
      None
    • ALL
    • Hide

      I have a collection with about a million records. The aggregation query explained above returns about 300k results which I am trying to dump into a collection with randomly generated name.

      This aggregation query fails with the below error:

      Mongo::error::operationfailure(insert for $out failed: { lastop:

      { ts: timestamp(1542714271, 9378), t: 39 }

      , connectionid: 242453, err: "e11000 duplicate key error collection: api smartquest co production.tmp.agg out.637144 index: id dup key: { : objectid('5bf2347a4b8a98775e4dbf95') }", code: 11000, codename: "duplicatekey", n: 0, ok: 1.0, operationtime: timestamp(1542714271, 9378), $clustertime: { clustertime: timestamp(1542714271, 9379), signature:

      { hash: bindata(0, 0000000000000000000000000000000000000000), keyid: 0 }

      } } (16996))

      Show
      I have a collection with about a million records. The aggregation query explained above returns about 300k results which I am trying to dump into a collection with randomly generated name. This aggregation query fails with the below error: Mongo::error::operationfailure(insert for $out failed: { lastop: { ts: timestamp(1542714271, 9378), t: 39 } , connectionid: 242453, err: "e11000 duplicate key error collection: api smartquest co production.tmp.agg out.637144 index: id dup key: { : objectid('5bf2347a4b8a98775e4dbf95') }", code: 11000, codename: "duplicatekey", n: 0, ok: 1.0, operationtime: timestamp(1542714271, 9378), $clustertime: { clustertime: timestamp(1542714271, 9379), signature: { hash: bindata(0, 0000000000000000000000000000000000000000), keyid: 0 } } } (16996))

      // db.sq_lesson_user_lessons.aggregate([ { "$match": { lesson_id: { "$in": [ObjectId("5bb6ec0a178353bbdecdd94d"), ObjectId("5bbf1e611783538013ce2f0a"), ObjectId("5bc1871a98f172c52b8710a6"), ObjectId("5bc1ceef0789fa947c1da8b2")] }, status: { "$in": ['featured','started','pending','completed'] } } }, { "$project": { _id: 1, user_profile_id: 1, status: 1, lesson_id: 1 } }, { "$out": "analytics_company_5bb6039598f17297c964fc54_sq_user_lessons" } ])
      

       

            Assignee:
            daniel.hatcher@mongodb.com Danny Hatcher (Inactive)
            Reporter:
            prchaudhari Prashant Chaudhari
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: