Issue with BulkUpsert - read: connection reset by peer

28 views
Skip to first unread message

el...@aniview.com

unread,
Jan 31, 2018, 11:02:24 AM1/31/18
to mgo-users
Hey ya'll!


I'm having an issue with Bulk upsert which I just can't figure out.. 
This is what Im trying to do:

I have an upsert function:

func (m *MongoManager) BulkUpsert(collectionName string, upsertObj []UpsertObj) (*mgo.BulkResult, error) {
session := m.s.Copy()
defer session.Close()
collection := session.DB(m.dbName).C(collectionName)

bulk := collection.Bulk()

var upsertOp []interface{}
for _, value := range upsertObj {
now := time.Now()
value.Data.GetMongoBase().UpdatedAt = now.Unix()

upsertOp = append(upsertOp, value.Query, value.Data)
}

return bulk.Run()
}

Where upsertObj is a simple struct of: 

type UpsertObj struct {
Query bson.M
Data AbstractBase
}

I'm trying to upsert 5-10 documents (I need to be able to upsert around 250-350) but keep getting this error message

closing: read tcp ip:port->ip:port: read: connection reset by peer (abend=true)

I'm clueless of what I'm doing wrong, (this is a working server in which we use all the time to do way more robustic actions) 

Any thoughts? 
Thanks!
4
Reply all
Reply to author
Forward
0 new messages