14

Motor 2.0

 7 years ago
source link: https://www.tuicool.com/articles/hit/aaUBBfb
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

am6Vz2j.png!web

To support multi-document transactions, I had to make breaking changes to Motor’s session API and release a major version bump, Motor 2.0. Since this is a major release I also deleted many helper methods and APIs that had been deprecated over time since Motor 1.0, most notably the old CRUD methods insertupdateremove , and  save , and the original callback-based API. Read the  Motor 2.0 Migration Guide carefully to upgrade your existing Motor application. Motor 2.0 also includes a Python 3.7 compatibility fix in the  MotorChangeStream class returned by  MotorCollection.watch .

Motor 2.0’s changes have a big impact for some applications, so I created a bridge release that raises DeprecationWarning for all the APIs that are deleted in Motor 2.0, especially the callback API, which hasn’t been deprecated before. Those DeprecationWarnings plus the Python 3.7 compatibility fix constitute Motor 1.3.0.

For applications that only need Python 3.7 compatibility, I’ve created Motor 1.2.4, which includes the Python 3.7 fix and no other changes.

Detailed release notes follow.

Motor 2.0

Motor 2.0 drops support for MongoDB 2.6 and adds supports MongoDB 4.0 features, including multi-document transactions, and change stream notifications on entire databases or entire MongoDB servers. This version of Motor requires PyMongo 3.7 or later.

Added support for aiohttp 3.0 and later, and dropped older aiohttp versions. The aiohttp integration now requires Python 3.5+.

This is a major release that removes previously deprecated APIs.

The MotorDatabase.add_user and MotorDatabase.remove_user methods are deleted. Manage user accounts with four database commands: createUserusersInfoupdateUser , and  dropUser . You can run any database command with the  MotorDatabase.command() method.

The deprecated GridFS classes MotorGridFS and AsyncIOMotorGridFS are deleted in favor of MotorGridFSBucket and  AsyncIOMotorGridFSBucket , which conform to driver specs for GridFS.

Additional changes:

Motor 1.3.0

Deprecate Motor’s old callback-based async API in preparation for removing it in Motor 2.0. Raise DeprecationWarning whenever a callback is passed.

Motor 1.2.4

Fix a Python 3.7 compatibility bug in the MotorChangeStream class returned by  MotorCollection.watch() . It is now possible to use change streams in async for loops in Python 3.7.

If you find issues, file a bug and I’ll respond promptly. But if it works for you, don’t be silent!— tweet at me and tell me.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK