Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-307

Insert methods do not seem propogate duplicate key errors

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 0.0.4
    • Affects Version/s: None
    • Component/s: CRUD

      I would expect the following code to print one of the "GOOD", but it doesn't, which means that we're ignoring an error somewhere.

      	client, err := mongo.NewClient("mongodb://localhost:27017")
      	if err != nil {
      		panic(err)
      	}
      	coll := client.Database("test").Collection("foo")
      	for i := 0; i < 10; i++ {
      		info, err := coll.InsertMany(nil, []interface{}{map[string]string{"_id": "one"}, map[string]string{"_id": "one"}})
      		if err != nil {
      			fmt.Println("GOOD", err, info)
      		} else {
      			fmt.Println(info)
      		}
      
      	}
      
      	for i := 0; i < 10; i++ {
      		info, err := coll.InsertOne(nil, map[string]string{"_id": "one"})
      		fmt.Println(info)
      		if err != nil {
      			fmt.Println("GOOD", err, info)
      		} else {
      			fmt.Println(info)
      		}
      	}
      
      

            Assignee:
            kris.brandow@mongodb.com Kristofer Brandow (Inactive)
            Reporter:
            sam.kleinman Sam Kleinman (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: