Docstring change and rename variable to avoid clash with kwargs

This commit is contained in:
srossiter 2015-11-24 12:53:09 +00:00
parent b7b28390df
commit 164e2b2678

View File

@ -473,8 +473,7 @@ class BaseQuerySet(object):
def upsert_one(self, write_concern=None, **update): def upsert_one(self, write_concern=None, **update):
"""Perform an atomic upsert on the fields of the first document """Overwrite or add the first document matched by the query.
matched by the query.
:param write_concern: Extra keyword arguments are passed down which :param write_concern: Extra keyword arguments are passed down which
will be used as options for the resultant will be used as options for the resultant
@ -486,16 +485,16 @@ class BaseQuerySet(object):
:returns the new or overwritten document :returns the new or overwritten document
.. versionadded:: 10.0.2 .. versionadded:: 0.10.2
""" """
update = self.update(multi=False, upsert=True, write_concern=write_concern, atomic_update = self.update(multi=False, upsert=True, write_concern=write_concern,
full_result=True,**update) full_result=True,**update)
if update['updatedExisting']: if atomic_update['updatedExisting']:
document = self.get() document = self.get()
else: else:
document = self._document.objects.with_id(update['upserted']) document = self._document.objects.with_id(atomic_update['upserted'])
return document return document
def update_one(self, upsert=False, write_concern=None, **update): def update_one(self, upsert=False, write_concern=None, **update):