Skip to content

Commit

Permalink
Make sure find_one_and_update returns the updated doc
Browse files Browse the repository at this point in the history
  • Loading branch information
ml-evs committed Nov 10, 2024
1 parent ebdd543 commit d4969ae
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pydatalab/src/pydatalab/routes/v0_1/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from flask import Blueprint, jsonify, redirect, request
from flask_login import current_user
from pydantic import ValidationError
from pymongo import ReturnDocument
from pymongo.command_cursor import CommandCursor

from pydatalab.blocks import BLOCK_TYPES
Expand Down Expand Up @@ -953,6 +954,7 @@ def save_item():
updated_doc = flask_mongo.db.items.find_one_and_update(
{"item_id": item_id},
{"$set": item},
return_document=ReturnDocument.AFTER,
)

if updated_doc is None:
Expand Down

0 comments on commit d4969ae

Please sign in to comment.