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))