better description for upsert arg on some methods
This commit is contained in:
parent
0a431ead5e
commit
21974f7288
@ -434,7 +434,7 @@ class BaseQuerySet(object):
|
|||||||
full_result=False, **update):
|
full_result=False, **update):
|
||||||
"""Perform an atomic update on the fields matched by the query.
|
"""Perform an atomic update on the fields matched by the query.
|
||||||
|
|
||||||
:param upsert: Any existing document with that "_id" is overwritten.
|
:param upsert: insert if document doesn't exist (default ``False``)
|
||||||
:param multi: Update multiple documents.
|
:param multi: Update multiple documents.
|
||||||
: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
|
||||||
@ -480,7 +480,6 @@ class BaseQuerySet(object):
|
|||||||
raise OperationError(message)
|
raise OperationError(message)
|
||||||
raise OperationError(u'Update failed (%s)' % unicode(err))
|
raise OperationError(u'Update failed (%s)' % unicode(err))
|
||||||
|
|
||||||
|
|
||||||
def upsert_one(self, write_concern=None, **update):
|
def upsert_one(self, write_concern=None, **update):
|
||||||
"""Overwrite or add the first document matched by the query.
|
"""Overwrite or add the first document matched by the query.
|
||||||
|
|
||||||
@ -498,7 +497,7 @@ class BaseQuerySet(object):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
atomic_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 atomic_update['updatedExisting']:
|
if atomic_update['updatedExisting']:
|
||||||
document = self.get()
|
document = self.get()
|
||||||
@ -510,7 +509,7 @@ class BaseQuerySet(object):
|
|||||||
"""Perform an atomic update on the fields of the first document
|
"""Perform an atomic update on the fields of the first document
|
||||||
matched by the query.
|
matched by the query.
|
||||||
|
|
||||||
:param upsert: Any existing document with that "_id" is overwritten.
|
:param upsert: insert if document doesn't exist (default ``False``)
|
||||||
: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
|
||||||
``getLastError`` command. For example,
|
``getLastError`` command. For example,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user