-
Notifications
You must be signed in to change notification settings - Fork 211
PyMongo 3 compatibility. #208
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
Conversation
"auto_start_request" option is gone, "max_pool_size" renamed to "maxPoolSize", "safe" is gone, "_connect" is renamed "connect". Closes issue django-nonrel#207.
Looks like the tests are failing. Can you take a look at that? Also, are these changes backwards compatible with older PyMongos? |
New installs of django_mongodb_engine are currently not working because of the PyMongo 3 compatibility issue. If this is going to take a while to get merged, can we fix the dependency to reference pymongo 2.8 in the meanwhile? |
Sorry for the delay on this, I haven't had a chance to return to this and won't for a while longer. The "AssertionError: Result batch started from 101, expected 0" errors are this PyMongo 3 bug, for which we've released a fix in PyMongo 3.0.1: https://jira.mongodb.org/browse/PYTHON-895 The other failures, I think, predate my patch so I didn't look deeply at them. |
I'm seeing quite a few of those assertion errors in the test log, so that should help a lot. What does it take to get the test rerun with 3.0.1 to see what remains? |
@jimfenton you could run it locally to see what happens. let me know what the outcome is. i'm happy to merge this in once the tests pass and someone lets me know whether this is a backwards compatible change. If its not backwards compatible, we can bump the version number. |
I patched in the relevant changes from ajdavis's fork, and my code still didn't run due to the issue with the cursor's "fields" argument having been renamed "projection" in PyMongo3 (see ajdavis's comment on issue 207 on May 2, 2015). That is one of the test failures as well so there seem to be multiple issues here that aren't addressed by 3.0.1. |
The "fields" parameter is renamed "projection" in PyMongo 3, but its position is the same.
"Connection" is renamed "MongoClient", "slave_okay" is gone, "network_timeout" is renamed "socketTimeoutMS", and "fsync" is deprecated in recent MongoDB versions. The doc is now equally for PyMongo 2 and 3.
I've added some more fixes to this PR:
AFAICT the remaining problem is the tests try to Peace, |
Oh and ReadPreference instances can't be copied, but Django wants to copy all options values. I fixed copying on PyMongo master. That'll be out in PyMongo 3.0.2. |
For what it's worth, today's commits have my application working now. Thanks. I'm afraid I'm a mongodb noob, so I don't know about the capped collection issue. |
One more issue (let me know if I should be commenting on the mailing list instead: Should django-mongodb provide save() and remove() models, or do we want to accept that some code will need to change, if not now, soon? |
PyMongo's save() and remove() are being deprecated in favor of the new http://www.mongodb.com/blog/post/consistent-crud-api-next-generation-mongodb-drivers However, we understand that actually removing those methods from the On Thu, May 7, 2015 at 6:22 PM, Jim Fenton [email protected] wrote:
|
@ajdavis @markunsworth you both have PRs for pymongo 3 compatibility. Not sure which one is more complete. Can you combine the effort into a single PR? It would be easier for me to review and merge in. Thanks! |
@markunsworth @aburgel I can't devote more time to this, please feel free to use my patch however it's most useful to you. If you have any questions about PyMongo 3, however, I'm happy to answer them (I'm one of its developers). Mention me on GitHub and I'll respond as quickly as I can. It might interest you that PyMongo 2.9 will be released in the next week or two with the intention of providing an API compatible with both PyMongo 2.8 and PyMongo 3, which should help efforts like this one. Here's PyMongo 2.9's list of changes to support a migration path from PyMongo 2 to 3: https://jira.mongodb.org/issues/?jql=fixVersion%20%3D%202.9%20AND%20project%20%3D%20PYTHON |
closing this in favor of #214 |
"auto_start_request" option is gone, "max_pool_size" renamed to "maxPoolSize", "safe" is gone, "_connect" is renamed "connect".