good morning!!!!

Skip to content
Snippets Groups Projects
Commit f13a4c0c authored by José Carlos Nieto's avatar José Carlos Nieto Committed by Maciej Lisiewski
Browse files

Using Upsert() instead of Insert() and Update(). Closing #13.

Conflicts:
	mongo/collection.go
parent 712b86dd
No related branches found
No related tags found
No related merge requests found
......@@ -207,13 +207,7 @@ func (self *Collection) Append(item interface{}) (interface{}, error) {
id = bson.NewObjectId()
// Allocating a new ID.
if err = self.collection.Insert(bson.M{"_id": id}); err != nil {
return nil, err
}
// Now append data the user wants to append.
if err = self.collection.Update(bson.M{"_id": id}, item); err != nil {
if _, err = self.collection.Upsert(bson.M{"_id": id}, item); err != nil {
return nil, err
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment