diff options
-rw-r--r-- | db/mongodb/client.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/db/mongodb/client.go b/db/mongodb/client.go index 963860e..e6e9f0b 100644 --- a/db/mongodb/client.go +++ b/db/mongodb/client.go | |||
@@ -93,7 +93,9 @@ func (m *Mongo) InsertOne(ctx context.Context, cn string, in interface{}) error | |||
93 | } | 93 | } |
94 | 94 | ||
95 | func (m *Mongo) ReplaceOneById(ctx context.Context, cn string, id string, in interface{}) error { | 95 | func (m *Mongo) ReplaceOneById(ctx context.Context, cn string, id string, in interface{}) error { |
96 | if _, err := m.db.Collection(cn).ReplaceOne(ctx, bson.M{"_id": id}, in); err != nil { | 96 | tp := true |
97 | opts := &options.ReplaceOptions{Upsert: &tp} | ||
98 | if _, err := m.db.Collection(cn).ReplaceOne(ctx, bson.M{"_id": id}, in, opts); err != nil { | ||
97 | return err | 99 | return err |
98 | } | 100 | } |
99 | 101 | ||