Changelog¶
Release 19.2.0 (2019-09-16)¶
Bugfixes¶
- Fixed compatibility with PyMongo 3.9.0+
- create_index() is now working with MongoDB 4.2
Release 19.1.0 (2019-03-26)¶
Features¶
- Allow passing only kwargs to Database.create_collection()
- Support for
mongodb+srv://URI scheme when installed with optional “srv” extra:pip install txmongo[srv]
Bugfixes¶
- Fixed RuntimeError: dictionary changed size during iteration in ConnectionPool.dicconnect #243
Release 18.2.0 (2018-07-19)¶
Bugfixes¶
- In combination with PyMongo 3.6.0 bulk_write might sometimes raise KeyError when bulk operation was interrupted (by failover, for example)
- Compatibility with PyMongo 3.7
Release 18.1.0 (2018-03-21)¶
Bugfixes¶
- Fixed compatibility of Collection.aggregate() with PyMongo 3.6
- AutoReconnect exceptions may give invalid stack traces when not handled
Features¶
- Added support for paged request: implementation of batchsize parameter in Collection.find_with_cursor
Release 17.1.0 (2017-08-11)¶
Bugfixes¶
- Memory leak fixed in Collection.bulk_write()
- Use authSource as auth database if specified in connect uri
- Compatibility with PyMongo 3.5.0+
Release 16.3.0 (2016-11-25)¶
Features¶
- Full-text indexes can be used with new
filter.TEXT() - Client authentication by X509 certificates. Use your client certificate when connecting
to MongoDB and then call
Database.authenticatewith certificate subject as username, empty password andmechanism="MONGODB-X509". get_version()to approximate the behaviour of get_version in PyMongo. One noteable exception is the omission of searching by random (unindexed) meta-data which should be considered a bad idea as it may create very variable conditions in terms of loading and timing.- New
ConnectionPool.drop_database()method for easy and convenient destruction of all your precious data. count()to return the number of versions of any given file in GridFS.
API Changes¶
find(),find_one(),find_with_cursor(),count()anddistinct()signatures changed to more closely match PyMongo’s counterparts. New signatures are:find(filter=None, projection=None, skip=0, limit=0, sort=None, **kwargs)find_with_cursor(filter=None, projection=None, skip=0, limit=0, sort=None, **kwargs)find_one(filter=None, projection=None, **kwargs)count(filter=None, **kwargs)distinct(key, filter=None, **kwargs)
Old signatures are now deprecated and will be supported in this and one subsequent releases. After that only new signatures will be valid.
cursorargument tofind()is deprecated. Please usefind_with_cursor()directly if you need to iterate over results by batches.cursorwill be supported in this and one subsequent releases.as_classargument tofind(),find_with_cursor()andfind_one()is deprecated. Please usecollection.with_options(codec_options=CodecOptions(document_class=...)).find()instead. It is lengthty, but it is more generic and this is how you do it with current PyMongo.Database.command()now takescodec_optionsargument.watchdog_intervalandwatchdog_timeoutarguments ofConnectionPoolrenamed toping_intervalandping_timeoutcorrespondingly along with internal change of connection aliveness checking mechanism.
Bugfixes¶
GridFS.get_last_version()was creating redundant index
Release 16.2.0 (2016-10-02)¶
Features¶
Collection.bulk_write()that maches behavior of corresponding PyMongo’s method. It accepts an iterable ofInsertOne,UpdateOne, … frompymongo.operations, packs them into batches and returns aggregated response from MongoDB.codec_optionsproperties forConnectionPool,DatabaseandCollection.Collection.with_options(codec_options=CodecOptions(document_class=...))is now preferred overCollection.find(..., as_class=...).
Bugfixes¶
- Fixed bug in find() that can cause undefined ordering of the results when sorting on multiple fields is requested.
Release 16.1.0 (2016-06-15)¶
API Changes¶
insert_many()raisesBulkWriteErrorinsteadWriteError/DuplicateKeyErrorto match PyMongo’s behavior. This is also allows to extract multiple duplicate key errors from exception object wheninsert_manyis used withordered=False.fieldsparameter removed forCollection.count().ConnectionPoolhas two new parameters:watchdog_intervalwhich is how many seconds before testing a connection to see if it is stale, andwatchdog_timeoutis how long the check takes before dropping the stale connection and try to reconnect.
Features¶
- Stale connections are now dropped after failing to contact mongodb longer than
watchdog_timeout. insert_many()is now able to insert more than 1000 documents and more than 16Mb of documents at once.- GridFS’s default
chunkSizechanged to 255kB, to avoid the overhead with usePowerOf2Sizes option. - Add
GridFS.indexes_createdto obtain a defer on the creation of the current GridFS instance’s indexes - GridFS create indexes for the
filescollection in addition to thechunksone
Release 16.0.1 (2016-03-03)¶
Features¶
- Make existing logging more verbose, indicate that it is TxMongo raising the error or sending the message.
- Add additional logging.
Release 16.0.0 (2016-02-25)¶
Bugfixes¶
- Memory leak fixed in find_with_cursor that affected almost all query methods
Release 15.3.1 (2015-10-26)¶
API Changes¶
connection.ConnectionPoolexposes max_delay which is used to set the maximum number of seconds between connection attempts. The default is set to 60.
Features¶
- Updated and simplified setup.py, enforce minimal versions of PyMongo and Twisted necessary to install TxMongo.
Release 15.3.0 (2015-09-29)¶
API Changes¶
NotMasterinstead ofAutoReconnecterror will be returned when a call can be safely retried.
Features¶
- Added
deadlinetocollectionmethods, this will raise aDeadlineExceededwhen the deadline, a unix timestamp in seconds, is exceeded. This happens only in methods withgetprotocol()and methods that reference them. - Added
timeouttocollectionmethods, this will raise aTimeoutExceededwhen the timeout, in seconds, is exceeded. This happens only in methods withgetprotocol()and methods that reference them.
Bugfixes¶
- Fixed
collection.count()to return an int instead of float, this matches how count in with PyMongo.
Release 15.2.2 (2015-09-15)¶
Bugfix release to handle str assert that wasn’t passing unicode properly in python 2.6, used Twisted compat library StringType.
Release 15.2.1 (2015-09-07)¶
Bugfix release to handle uncaught exceptions in logging and to remove support for python 2.6 and since it was removed in latest Twisted.
Release 15.2 (2015-09-05)¶
This release makes TxMongo fully Python3 compatible and has an API change that breaks older TxMongo compatibility by bringing it inline with PyMongo.
API Changes¶
txmongo.dbrefremoved. Usebson.dbrefinstead. Incompatibility note:bson.dbref.DBReftakes collection name as string whiletxmongo.dbref.DBRefwas able to acceptCollectioninstance. Please usecollection.nameinstead.- Added
timeoutparameter forconnection.ConnectionPoolthat can passed on to Twisted’sconnectTCPandconnectSSLmethods.
Features¶
name,full_nameanddatabaseproperties ofCollection- Python3 compatible.
Release 15.1 (2015-06-08)¶
This is a major release in that while increasing code coverage to 95% ( see https://coveralls.io/builds/2749499 ), we’ve also caught several bugs, added features and changed functionality to be more inline with PyMongo.
This is no small thanks to travis-ci and coveralls while using tox to cover all iterations that we support.
We can officially say that we are Python 2.6, 2.7 and PyPy compatible.
API Changes¶
- TxMongo now requires PyMongo 3.x, if you need PyMongo 2.x support, please use 15.0, otherwise it is highgly recommend to use PyMongo 3.x which still support MongoDB 2.6.
- Better handling of replica-sets, we now raise an
autoreconnectwhen master is unreachable. - Changed the behaviour of
find_oneto returnNoneinstead of an empty dict{}when no result is found. - New-style query methods:
insert_one/many,update_one/many,delete_one/many,replace_oneandfind_one_and_update/replace
Features¶
- Added
db.commandfunction, just like PyMongo. - Added support for named indexes in
filter. insert(),update(),save()andremove()now support write-concern options via named args:w,wtimeout,j,fsync.safeargument is still supported for backward compatibility.- Default write-concern can be specified for
Connectionusing named arguments in constructor or by URI options. - Write-concern options can also be set for
DatabaseandCollectionwithwrite_concernnamed argument of their constructors. In this case write-concern is specified by instance ofpymongo.write_concern.WriteConcern txmongo.protocol.INSERT_CONTINUE_ON_ERRORflag defined for using withinsert()- Replaced all traditional deferred callbacks (and errbacks) to use @defer.inlineCallbacks
Bugfixes¶
- Fixed typo in
map_reduce()when returning results. - Fixed hang in
create_collection()in case of error. - Fixed typo in
rename()that wasn’t using the right factory. - Fixed exception in
drop_indexthat was being thrown when dropping a non-existent collection. This makes the function idempotent. - Fixed URI prefixing when “mongodb://” is not present in URI string in
connection. - Fixed fail-over when using replica-sets in
connection. It now raisesautoreconnectwhen there is a problem with the existing master. It is then up to the client code to reconnect to the new master. - Fixed number of cursors in protocol so that it works with py2.6, py2.6 and pypy.
Release 15.0 (2015-05-04)¶
This is the first release using the Twisted versioning method.
API Changes¶
collections.index_informationnow mirrors PyMongo’s method.getrequestidis nowget_request_id
Features¶
- Add support for 2dsphere indexes, see http://docs.mongodb.org/manual/tutorial/build-a-2dsphere-index/
- PEP8 across files as we work through them.
- Authentication reimplemented for ConnectionPool support with multiple DBs.
- Add support for MongoDB 3.0
Bugfixes¶
- Fixed failing tests due to changes in Python in 2.6
- Fixed limit not being respected, which should help performance.
- Find now closes MongoDB cursors.
- Fixed ‘hint’ filter to correctly serialize with double dollar signs.
Improved Documentation¶
- Added, updated and reworked documentation using Sphinx.
- The documentation is now hosted on https://txmongo.readthedocs.org/.
Release 0.6 (2015-01-23)¶
This is the last release in this version scheme, we’ll be switching to the Twisted version scheme in the next release.
API Changes¶
- TxMongo: None
Features¶
- Added SSL support using Twisted SSLContext factory
- Added “find with cursor” like pymongo
- Test coverage is now measured. We’re currently at around 78%.
Bugfixes¶
- Fixed import in database.py