ApierV1.SetAccount and APierV1.GetAccountActionPlan using AccountActionPlans for indexing

This commit is contained in:
DanB
2017-01-13 19:36:18 +01:00
parent 5847e7fff9
commit e4de4a2e6c
3 changed files with 46 additions and 40 deletions

View File

@@ -1473,11 +1473,11 @@ func (ms *MongoStorage) SetActionTriggers(key string, atrs ActionTriggers, trans
session, col := ms.conn(colAtr)
defer session.Close()
if len(atrs) == 0 {
err = col.Remove(bson.M{"key": key}) // delete the key
if err != mgo.ErrNotFound {
return err
err = col.Remove(bson.M{"key": key})
if err == mgo.ErrNotFound { // Overwrite not found since it is not really mandatory here to be returned
err = nil
}
return nil
return
}
_, err = col.Upsert(bson.M{"key": key}, &struct {
Key string