mirror of
https://github.com/lus/pasty.git
synced 2023-08-10 21:13:09 +03:00
mongodb_driver: Update to support MongoDB 4.2+
https://docs.mongodb.com/manual/reference/method/db.collection.updateOne/\#update-with-an-aggregation-pipeline Signed-off-by: baalajimaestro <me@baalajimaestro.me>
This commit is contained in:
parent
6e043ef7a7
commit
7efab1dd4f
@ -119,7 +119,7 @@ func (driver *MongoDBDriver) Save(paste *shared.Paste) error {
|
||||
|
||||
// Upsert the paste object
|
||||
filter := bson.M{"_id": paste.ID}
|
||||
_, err := collection.UpdateOne(ctx, filter, paste, options.Update().SetUpsert(true))
|
||||
_, err := collection.UpdateOne(ctx, filter, bson.M{"$set": paste,}, options.Update().SetUpsert(true))
|
||||
return err
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user