diff options
author | Victor Morales <victor.morales@intel.com> | 2019-01-16 21:37:57 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-01-16 21:37:57 +0000 |
commit | 40a8c03fc466d81028a496060244d887cf86da2b (patch) | |
tree | eff96f803a427cd60667bd8c9a2e9d6f3695860a /src | |
parent | 326452d9421322e8e08b145ef797496dff2ef954 (diff) | |
parent | f9d0212e7edbabc554ca539e193b39f0b2cacdd7 (diff) |
Merge "Check if no document is returned before error"
Diffstat (limited to 'src')
-rw-r--r-- | src/k8splugin/db/mongo.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/k8splugin/db/mongo.go b/src/k8splugin/db/mongo.go index 311f044c..65e721c3 100644 --- a/src/k8splugin/db/mongo.go +++ b/src/k8splugin/db/mongo.go @@ -224,6 +224,11 @@ func (m *MongoStore) Delete(coll, key, tag string) error { keydata, err := decodeBytes(c.FindOneAndUpdate(ctx, filter, update, options.FindOneAndUpdate().SetReturnDocument(options.Before))) if err != nil { + //No document was found. Return nil. + if err == mongo.ErrNoDocuments { + return nil + } + //Return any other error that was found. return pkgerrors.Errorf("Error decoding master table after update: %s", err.Error()) } |