1
0
mirror of https://github.com/lus/pasty.git synced 2023-08-10 21:13:09 +03:00

Mongo: Uprev Driver and update code for MongoDB Server 4.2+ (#27)

* Update mongodb driver to 1.8.0

Signed-off-by: baalajimaestro <me@baalajimaestro.me>

* 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:
Baalaji
2021-11-28 00:04:57 +05:30
committed by GitHub
parent ec1b8bc418
commit 15b32b093e
3 changed files with 26 additions and 3 deletions

View File

@ -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
}