good morning!!!!

Skip to content
Snippets Groups Projects
Commit 1f580b50 authored by Carlos Nieto's avatar Carlos Nieto
Browse files

Using UpsertId.

parent 8a243f9f
No related branches found
No related tags found
No related merge requests found
......@@ -22,8 +22,8 @@
*/
/*
Tha main goal of the upper.io/db is simple: to save Go maps or structs to a
permanent storage engine and then stay out of the way.
The main goal of the upper.io/db package is to provide a simple way to save
and retrive Go structs to and from permantent storage.
*/
package db
......
......@@ -91,9 +91,11 @@ func compileStatement(where db.Cond) bson.M {
default:
op = chunks[1]
}
conds[chunks[0]] = bson.M{op: toInternal(val)}
//conds[chunks[0]] = bson.M{op: toInternal(val)}
conds[chunks[0]] = bson.M{op: val}
} else {
conds[key] = toInternal(val)
//conds[key] = toInternal(val)
conds[key] = val
}
}
......@@ -183,7 +185,7 @@ func (self *Collection) Append(item interface{}) (interface{}, error) {
var id bson.ObjectId
// Dirty trick to return the Id with ease.
res, err := self.collection.Upsert(bson.M{"_id": nil}, toInternal(item))
res, err := self.collection.UpsertId(nil, item)
if err != nil {
return nil, err
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment