-
Notifications
You must be signed in to change notification settings - Fork 1.1k
PYTHON-1307 Remove SONManipulator APIs #557
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -554,15 +554,9 @@ def _legacy_write(self, sock_info, name, cmd, op_id, | |
|
||
def _insert_one( | ||
self, doc, ordered, | ||
check_keys, manipulate, write_concern, op_id, bypass_doc_val, | ||
check_keys, write_concern, op_id, bypass_doc_val, | ||
session): | ||
"""Internal helper for inserting a single document.""" | ||
if manipulate: | ||
doc = self.__database._apply_incoming_manipulators(doc, self) | ||
if not isinstance(doc, RawBSONDocument) and '_id' not in doc: | ||
doc['_id'] = ObjectId() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess this was just here for legacy insert()? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, the non-legacy |
||
doc = self.__database._apply_incoming_copying_manipulators(doc, | ||
self) | ||
write_concern = write_concern or self.write_concern | ||
acknowledged = write_concern.acknowledged | ||
command = SON([('insert', self.name), | ||
|
@@ -646,7 +640,7 @@ def insert_one(self, document, bypass_document_validation=False, | |
write_concern = self._write_concern_for(session) | ||
return InsertOneResult( | ||
self._insert_one( | ||
document, ordered=True, check_keys=True, manipulate=False, | ||
document, ordered=True, check_keys=True, | ||
write_concern=write_concern, op_id=None, | ||
bypass_doc_val=bypass_document_validation, session=session), | ||
write_concern.acknowledged) | ||
|
@@ -712,14 +706,12 @@ def gen(): | |
return InsertManyResult(inserted_ids, write_concern.acknowledged) | ||
|
||
def _update(self, sock_info, criteria, document, upsert=False, | ||
check_keys=True, multi=False, manipulate=False, | ||
check_keys=True, multi=False, | ||
write_concern=None, op_id=None, ordered=True, | ||
bypass_doc_val=False, collation=None, array_filters=None, | ||
hint=None, session=None, retryable_write=False): | ||
"""Internal update / replace helper.""" | ||
common.validate_boolean("upsert", upsert) | ||
if manipulate: | ||
document = self.__database._fix_incoming(document, self) | ||
collation = validate_collation_or_none(collation) | ||
write_concern = write_concern or self.write_concern | ||
acknowledged = write_concern.acknowledged | ||
|
@@ -801,15 +793,15 @@ def _update(self, sock_info, criteria, document, upsert=False, | |
|
||
def _update_retryable( | ||
self, criteria, document, upsert=False, | ||
check_keys=True, multi=False, manipulate=False, | ||
check_keys=True, multi=False, | ||
write_concern=None, op_id=None, ordered=True, | ||
bypass_doc_val=False, collation=None, array_filters=None, | ||
hint=None, session=None): | ||
"""Internal update / replace helper.""" | ||
def _update(session, sock_info, retryable_write): | ||
return self._update( | ||
sock_info, criteria, document, upsert=upsert, | ||
check_keys=check_keys, multi=multi, manipulate=manipulate, | ||
check_keys=check_keys, multi=multi, | ||
write_concern=write_concern, op_id=op_id, ordered=ordered, | ||
bypass_doc_val=bypass_doc_val, collation=collation, | ||
array_filters=array_filters, hint=hint, session=session, | ||
|
@@ -1346,8 +1338,6 @@ def find(self, *args, **kwargs): | |
oplogReplay query flag. Default: False. | ||
- `batch_size` (optional): Limits the number of documents returned in | ||
a single batch. | ||
- `manipulate` (optional): **DEPRECATED** - If True, apply any | ||
outgoing SON manipulators before returning. Default: True. | ||
- `collation` (optional): An instance of | ||
:class:`~pymongo.collation.Collation`. This option is only supported | ||
on MongoDB 3.4 and above. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did we just forget to document allow_disk_use?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. I just opened https://jira.mongodb.org/browse/PYTHON-2524 to backport this change to 3.X.