[GODRIVER-307] Insert methods do not seem propogate duplicate key errors Created: 25/Mar/18  Updated: 28/Oct/23  Resolved: 27/Apr/18

Status: Closed
Project: Go Driver
Component/s: CRUD
Affects Version/s: None
Fix Version/s: 0.0.4

Type: Bug Priority: Major - P3
Reporter: Sam Kleinman (Inactive) Assignee: Kristofer Brandow (Inactive)
Resolution: Fixed Votes: 0
Labels: Stitch, evg
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Problem/Incident
is caused by GODRIVER-312 Ensure WriteErrors are returned to th... Closed

 Description   

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



 Comments   
Comment by Githook User [ 27/Apr/18 ]

Author:

{'email': 'kris@mongodb.com', 'username': 'skriptble', 'name': 'Kris Brandow'}

Message: Ensure write operation error are returned

GODRIVER-312
GODRIVER-307
GODRIVER-347

Change-Id: Ib3321215285029b9602f27ca4a89d588ef643238
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/0dfcbabcc0f2b9032e3f1ce413996c900f52a06c

Comment by Jeffrey Yemin [ 23/Apr/18 ]

Waiting on GODRIVER-312. This is essentially a duplicate.

Generated at Thu Feb 08 08:33:56 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.