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:
@ -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
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user