You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So #300 has been done, get_or_create has gone, good riddance.
The behaviour is still very useful and can be achieved with an upsert. However, whereas get_or_create returned a document, update_one with full_result=True returns a dict with some info about the result of the operation.
This has led me to write something like this a few times:
So #300 has been done,
get_or_create
has gone, good riddance.The behaviour is still very useful and can be achieved with an
upsert
. However, whereasget_or_create
returned a document,update_one
withfull_result=True
returns adict
with some info about the result of the operation.This has led me to write something like this a few times:
Three questions:
My proposed answers:
upsert_one
method on BaseQuerySet (Upsert one #1167)Appreciate any thoughts.
EDIT: For anyone finding this in future I changed point 3 above to match the accepted PR #1167
The text was updated successfully, but these errors were encountered: