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-05-08 23:45:35 +02:00
parent 1907133f99
commit 9ae8fe7c2d
4 changed files with 89 additions and 34 deletions

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