diff --git a/doc/api/pymongo/index.rst b/doc/api/pymongo/index.rst index 577014593..8a3a99b81 100644 --- a/doc/api/pymongo/index.rst +++ b/doc/api/pymongo/index.rst @@ -39,7 +39,6 @@ Sub-modules: encryption encryption_options errors - message mongo_client monitoring operations diff --git a/doc/api/pymongo/message.rst b/doc/api/pymongo/message.rst deleted file mode 100644 index 0a28052fb..000000000 --- a/doc/api/pymongo/message.rst +++ /dev/null @@ -1,6 +0,0 @@ -:mod:`message` -- Tools for creating messages to be sent to MongoDB -=================================================================== - -.. automodule:: pymongo.message - :synopsis: Tools for creating messages to be sent to MongoDB - :members: diff --git a/doc/changelog.rst b/doc/changelog.rst index 05e737c01..189e33e00 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -80,6 +80,9 @@ Breaking Changes in 4.0 :meth:`~pymongo.collection.Collection.find`, :meth:`~pymongo.collection.Collection.find_one`, and :meth:`~pymongo.cursor.Cursor`. +- Removed :meth:`pymongo.message.delete`, :meth:`pymongo.message.get_more`, + :meth:`pymongo.message.insert`, :meth:`pymongo.message.kill_cursors`, + :meth:`pymongo.message.query`, and :meth:`pymongo.message.update`. - Removed :exc:`pymongo.errors.NotMasterError`. Use :exc:`pymongo.errors.NotPrimaryError` instead. - Removed :attr:`pymongo.GEOHAYSTACK`. diff --git a/doc/migrate-to-pymongo4.rst b/doc/migrate-to-pymongo4.rst index 93f9baf64..7c741e8cb 100644 --- a/doc/migrate-to-pymongo4.rst +++ b/doc/migrate-to-pymongo4.rst @@ -555,3 +555,10 @@ Removed :meth:`~pymongo.collection.Collection.parallel_scan`. MongoDB 4.2 removed the `parallelCollectionScan command`_. There is no replacement. .. _parallelCollectionScan command: https://docs.mongodb.com/manual/reference/command/parallelCollectionScan/ + +pymongo.message helpers are removed +................................... + +Removed :meth:`pymongo.message.delete`, :meth:`pymongo.message.get_more`, +:meth:`pymongo.message.insert`, :meth:`pymongo.message.kill_cursors`, +:meth:`pymongo.message.query`, and :meth:`pymongo.message.update`. diff --git a/pymongo/collection.py b/pymongo/collection.py index a2fb4bd19..e4cb2487b 100644 --- a/pymongo/collection.py +++ b/pymongo/collection.py @@ -507,7 +507,7 @@ class Collection(common.BaseObject): # Legacy OP_INSERT. return self._legacy_write( sock_info, 'insert', command, op_id, - bypass_doc_val, message.insert, self.__full_name, + bypass_doc_val, message._insert, self.__full_name, [doc], check_keys, False, self.__write_response_codec_options) @@ -697,7 +697,7 @@ class Collection(common.BaseObject): # Legacy OP_UPDATE. return self._legacy_write( sock_info, 'update', command, op_id, - bypass_doc_val, message.update, self.__full_name, upsert, + bypass_doc_val, message._update, self.__full_name, upsert, multi, criteria, document, check_keys, self.__write_response_codec_options) @@ -1047,7 +1047,7 @@ class Collection(common.BaseObject): # Legacy OP_DELETE. return self._legacy_write( sock_info, 'delete', command, op_id, - False, message.delete, self.__full_name, criteria, + False, message._delete, self.__full_name, criteria, self.__write_response_codec_options, int(not multi)) # Delete command. diff --git a/pymongo/message.py b/pymongo/message.py index 60be0c7e7..12ca524ff 100644 --- a/pymongo/message.py +++ b/pymongo/message.py @@ -364,9 +364,9 @@ class _Query(object): spec = _maybe_add_read_preference(spec, self.read_preference) - return query(flags, ns, self.ntoskip, ntoreturn, - spec, None if use_cmd else self.fields, - self.codec_options, ctx=sock_info.compression_context) + return _query(flags, ns, self.ntoskip, ntoreturn, + spec, None if use_cmd else self.fields, + self.codec_options, ctx=sock_info.compression_context) class _GetMore(object): @@ -450,9 +450,10 @@ class _GetMore(object): ctx=sock_info.compression_context) return request_id, msg, size ns = "%s.%s" % (self.db, "$cmd") - return query(0, ns, 0, -1, spec, None, self.codec_options, ctx=ctx) + return _query(0, ns, 0, -1, spec, None, self.codec_options, + ctx=ctx) - return get_more(ns, self.ntoreturn, self.cursor_id, ctx) + return _get_more(ns, self.ntoreturn, self.cursor_id, ctx) class _RawBatchQuery(_Query): @@ -532,8 +533,8 @@ def __last_error(namespace, args): cmd = SON([("getlasterror", 1)]) cmd.update(args) splitns = namespace.split('.', 1) - return query(0, splitns[0] + '.$cmd', 0, -1, cmd, - None, DEFAULT_CODEC_OPTIONS) + return _query(0, splitns[0] + '.$cmd', 0, -1, cmd, + None, DEFAULT_CODEC_OPTIONS) _pack_header = struct.Struct(" max_bson_size): message._raise_document_too_large(name, size, max_bson_size) else: - request_id, msg, size = message.query( + request_id, msg, size = message._query( flags, ns, 0, -1, spec, None, codec_options, check_keys, compression_ctx) diff --git a/test/test_pooling.py b/test/test_pooling.py index 5746f56d1..97a994ec3 100644 --- a/test/test_pooling.py +++ b/test/test_pooling.py @@ -282,7 +282,7 @@ class TestPooling(_TestPoolingBase): self.assertTrue(socket_checker.select(s, write=True, timeout=0)) self.assertTrue(socket_checker.select(s, write=True, timeout=.05)) # Make the socket readable - _, msg, _ = message.query( + _, msg, _ = message._query( 0, 'admin.$cmd', 0, -1, SON([('isMaster', 1)]), None, DEFAULT_CODEC_OPTIONS) s.sendall(msg)