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) } }
- is caused by
-
GODRIVER-312 Ensure WriteErrors are returned to the user
- Closed