Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-725

InsertBatch throws duplicate key exception with too much data... (140.000 item, 13MB) but inserts all data correctly

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 1.8
    • Component/s: None
    • Labels:
      None
    • Environment:
      fully updated windows 7 development machine

      In the code i first fill the items to List.
      var datas = new List<MyData>(); // 144000 MyData

      then call the InsertBatch method.
      var _collection = _mongoDatabase.GetCollection<MyData>("MYDATA", WriteConcern.Acknowledged);
      _collection.InsertBatch(datas);

      this throws these exceptions. if I look at the collection i see all the data inserted correctly. When I try with 10k data it works correctly. The data is clear in all lines. It is probably the size problem but the exception is miss leadling.

      Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host.

      WriteConcern detected an error 'E11000 duplicate key error index: MYDB.MYDATA.$id dup key: { : ObjectId('51681daf1e72b21b1839877b') }'. (Response was { "err" : "E11000 duplicate key error index: MYDB.MYDATA.$id dup key: { : ObjectId('51681daf1e72b21b1839877b') }", "code" : 11000, "n" : 0, "connectionId" : 19, "ok" : 1.0 }).

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            serdarb Serdar Büyüktemiz
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: