From 611094e92e7994c03ba54e68ded8a9a2d7db9175 Mon Sep 17 00:00:00 2001 From: Erdenezul Batmunkh Date: Fri, 9 Nov 2018 09:20:55 +0800 Subject: [PATCH] Refactor write_concern #1945 --- mongoengine/document.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/mongoengine/document.py b/mongoengine/document.py index fc379b61..f2e3664c 100644 --- a/mongoengine/document.py +++ b/mongoengine/document.py @@ -297,7 +297,7 @@ class Document(six.with_metaclass(TopLevelDocumentMetaclass, BaseDocument)): return True def save(self, force_insert=False, validate=True, clean=True, - write_concern=None, cascade=None, cascade_kwargs=None, + write_concern={'w': 1}, cascade=None, cascade_kwargs=None, _refs=None, save_condition=None, signal_kwargs=None, **kwargs): """Save the :class:`~mongoengine.Document` to the database. If the document already exists, it will be updated, otherwise it will be @@ -359,9 +359,6 @@ class Document(six.with_metaclass(TopLevelDocumentMetaclass, BaseDocument)): if validate: self.validate(clean=clean) - if write_concern is None: - write_concern = {'w': 1} - doc = self.to_mongo() created = ('_id' not in doc or self._created or force_insert)