Improve perf of Doc.save by preventing a full to_mongo() call just to get the created variable

This commit is contained in:
Bastien Gérard
2019-06-01 11:13:28 +02:00
parent 1907133f99
commit 9ae8fe7c2d
4 changed files with 89 additions and 34 deletions
+1 -2
View File
@@ -293,8 +293,7 @@ class BaseDocument(object):
"""
Return as SON data ready for use with MongoDB.
"""
if not fields:
fields = []
fields = fields or []
data = SON()
data['_id'] = None