-
Notifications
You must be signed in to change notification settings - Fork 211
Support for pymongo 3 #214
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
Changes from 27 commits
568dd07
e257266
075608d
f3a2215
9fa43d4
681b712
292e74c
5b4e11d
69e028f
b02729c
236b152
8bc14d4
495b82d
1573e06
57cc51d
2f259b4
30a6acf
801d7bf
5edbaef
c0dcc66
fef0185
c1bb7dc
af3d08b
7395f5f
122e62b
e6d2b38
7faa4a4
605dfcb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,7 @@ dist/ | |
.tox | ||
|
||
MANIFEST | ||
|
||
|
||
.env | ||
.idea |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,8 @@ class DatabaseFeatures(NonrelDatabaseFeatures): | |
supports_microsecond_precision = False | ||
supports_long_model_names = False | ||
|
||
can_rollback_ddl = True | ||
|
||
|
||
class DatabaseOperations(NonrelDatabaseOperations): | ||
compiler_module = __name__.rsplit('.', 1)[0] + '.compiler' | ||
|
@@ -60,6 +62,9 @@ def sql_flush(self, style, tables, sequence_list, allow_cascade=False): | |
drop all `tables`. No SQL in MongoDB, so just clear all tables | ||
here and return an empty list. | ||
""" | ||
|
||
|
||
|
||
for table in tables: | ||
if table.startswith('system.'): | ||
# Do not try to drop system collections. | ||
|
@@ -69,6 +74,8 @@ def sql_flush(self, style, tables, sequence_list, allow_cascade=False): | |
options = collection.options() | ||
|
||
if not options.get('capped', False): | ||
|
||
# TODO:Not backwards compatible | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what's this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A comment i'd forgotten to remove after making this backwards compatible. Was using the new pymongo 3 deleteMany |
||
collection.remove({}) | ||
|
||
return [] | ||
|
@@ -246,11 +253,6 @@ def pop(name, default=None): | |
warnings.warn("slave_okay has been deprecated. " | ||
"Please use read_preference instead.") | ||
|
||
if replicaset: | ||
connection_class = MongoReplicaSetClient | ||
else: | ||
connection_class = MongoClient | ||
|
||
conn_options = dict( | ||
host=host, | ||
port=int(port), | ||
|
@@ -259,6 +261,11 @@ def pop(name, default=None): | |
) | ||
conn_options.update(options) | ||
|
||
if replicaset: | ||
connection_class = MongoReplicaSetClient | ||
else: | ||
connection_class = MongoClient | ||
|
||
try: | ||
self.connection = connection_class(**conn_options) | ||
self.database = self.connection[db_name] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
pymongo<3.0 | ||
|
||
pymongo>=3.0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should this be changed to >=2.9? |
||
|
||
https://github.com/django-nonrel/djangotoolbox/tarball/master | ||
https://github.com/django-nonrel/django/tarball/nonrel-1.5 | ||
https://github.com/django-nonrel/django-dbindexer/tarball/master |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,11 @@ | |
class LookupTests(TestCase): | ||
|
||
def setUp(self): | ||
|
||
Author.objects.all().delete() | ||
Article.objects.all().delete() | ||
Tag.objects.all().delete() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this looks the same as the following 3 lines There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah, thought i'd removed all of these. Thanks |
||
|
||
# Create a few Authors. | ||
Author.objects.all().delete() | ||
Article.objects.all().delete() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does django 1.7 actually work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not yet (am planning to look at that next). I've added it to the allowable failures for now