Ordered op_insert should check for errors on the last insert.
Use _Bulk API for Collection.insert.
Avoid sending acknowledged inserts as much as possible.
max_cmd_size already accounts for trailing null bytes.
Use _OpReply class instead of passing bytes around.
Remove unnecessary operation argument to receive message.
Move _first_batch to message.py to avoid circular import.
This change removes the u() helper from bson.py3compat
and all of its uses in the driver and tests. PyPy3 continues
to be supported since, even though it is based on python 3.2.5,
it has always supported the u string prefix.
The README and install docs are now explicit about PyPy(3) support.
This commit implements the following simplifications and improvements:
- The Subscriber ABC has been renamed to CommandListener
- The subscribe function has been renamed to register
- The COMMAND constant has been removed
- The get_subscribers function has been removed
- Command listeners can now be registered per MongoClient instance
instead of just globally
This change adds monitoring of bulk write operations (i.e.
Collection.bulk_write, Collection.insert_many, Collection.insert with multiple
documents, Bulk.execute, etc.). It also fixes bugs in conversion of legacy
write results to write command result format and conversion of legacy queries
to find command documents. Finally, it adds an operation_id attribute to the
published events to tie related events together.
We weren't including the time to decode responses in
a number of places. This commit also fixes an issue with
handling "cursor not found" errors from mongos versions
older than 2.4.
This commit adds support for monitoring queries and getMore
operations, including getMore operations for command cursors
(e.g. aggregate cursor getMore). It also fixes a bug in duration
calculation.
* PYTHON-857-writable-max-wv:
PYTHON-857 - Update C version of batch writes.
PYTHON-857 - Fix SlaveOkay wire protocol bit for mapreduce.
PYTHON-857 - Delete MongoClient._writable_max_wire_version().
PYTHON-857 - Rename _get_socket_for_writes to _socket_for_writes.
PYTHON-857 - Delete MongoClient._send_message.
PYTHON-857 - Fix "not master" error handling.
PYTHON-857 - Remove MongoClient.__check_gle_response.
PYTHON-857 - Collection and Database use SocketInfo.command.
PYTHON-857 - Complete wire-protocol race fix in Bulk API.
PYTHON-857 - Simplify _Bulk.execute_no_results.
PYTHON-857 - Pass socket to Collection._insert() etc.
PYTHON-857 - Faster attribute access on SocketInfo.
Remove MongoDB 2.5.x-specific code for retrieving an upserted _id.
PYTHON-857 - Use SocketInfo, not MongoClient, in message.py.
Obsolete comment about max write command size.
PYTHON-857 - Fix server-reset logic.
PYTHON-857 - Use client._get_socket_for_writes for write commands.
PYTHON-857 - Use client._get_socket_for_writes for OP_UPDATE and OP_DELETE.
PYTHON-857 - Use client._get_socket_for_writes for OP_INSERT.
Conflicts:
pymongo/collection.py
pymongo/helpers.py
We must get a socket *before* choosing whether to use write commands or legacy
writes. I will update the code in steps, getting a socket earlier and earlier
in the write path.
This commit gets a socket just before sending OP_INSERT in _do_batched_insert,
and temporarily disables the C version of _do_batched_insert.
This change resolves four issues:
PYTHON-826 The new codec_options submodule is moved from pymongo to bson.
PYTHON-827 Use codec_options in BSON APIs.
Functions and methods of the bson module that accepted the options as_class,
tz_aware, and uuid_subtype now accept a codec_options parameter instead.
For example, the function definition for bson.decode_all changes from this:
def decode_all(data, as_class=dict, tz_aware=True,
uuid_subtype=OLD_UUID_SUBTYPE)
to:
def decode_all(data, codec_options=CodecOptions())
The following functions are changed:
- decode_all
- decode_iter
- decode_file_iter
The following methods are changed:
- BSON.encode
- BSON.decode
This is a breaking change for any application that uses the BSON API directly
and changes any of the named parameter defaults. No changes are required for
applications that use the default values for these options. The behavior
remains the same.
PYTHON-828 Internal BSON module changes to support CodecOptions
The pure Python BSON module passes around a CodecOptions instance instead of
as_class, tz_aware, and uuid_subtype. C extensions pass these values around in
a struct.
PYTHON-801 Rename uuid_subtype to uuid_representation.
This change introduces a _command helper in the helpers
module, used by Database.command and various internal and
external command helpers instead of iterating a Cursor
instance.
This change also introduces a small incompatibility with
earier versions. The as_class and fields options have been
removed from Database.command. They were never documented
and only used by some internal helpers. This also removes
the documented uuid_subtype option. A forthcoming API
refactor will replace that functionality.