Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When updating existing document and document was deleted before the save, a partial document is created #1545

Closed
TamarNevo opened this issue May 4, 2017 · 1 comment

Comments

@TamarNevo
Copy link

To reproduce, use the following steps:

  1. user 1 reads document 1 (or - read document 1 into variable v1)
  2. user 2 reads document 1 (or - read document 1 into variable v2)
  3. user 1 deletes document 1 (or - perform v1.delete())
  4. user 2 updates one field in document 1 (or - change value of one field in v2, and perform v2.save())
    The result is - document 1 is re-created with only one field.

The expected behavior in this case is failure of the update operation. This can be achieved by using upsert=False.

In document.py, _save_update() is using upsert=True when no save_condition is requested.
There is no actual need to use upsert=True since this method is called for updating an existing document (New documents are handled in _save_insert).

@wojcikstefan
Copy link
Member

Thank you for reporting it @TamarNevo! That said, there already exists an issue for this problem: #564 (consider leaving a thumbs-up on it).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants