-
Type:
New Feature
-
Resolution: Done
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Iteration 3.1.0
-
Not Needed
here's a crude diff that seems to demonstrate the solution
dan:(git)mongo-tools[master]/$ d
diff --git a/mongorestore/restore.go b/mongorestore/restore.go
index 4270fab..9184151 100644
--- a/mongorestore/restore.go
+++ b/mongorestore/restore.go
@@ -236,8 +236,13 @@ func (restore *MongoRestore) RestoreCollectionToDB(dbName, colName string, bsonS
}()
for i := 0; i < MaxInsertThreads; i++ {
+
go func() {
+ s:=session.Copy()
+ defer s.Close()
+ collection = collection.With(s)
bulk := db.NewBufferedBulkInserter(collection, restore.ToolOptions.BulkBufferSize, !restore.OutputOptions.StopOnError)
+ bulk.Worker = i
for rawDoc := range docChan {
if restore.objCheck {
err := bson.Unmarshal(rawDoc.Data, &bson.D{})