Skip to content

Commit c5ed308

Browse files
committed
comments update after having tested PyMongo 3.0.1
1 parent 3ab5ba6 commit c5ed308

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

mongoengine/document.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,9 @@ def save(self, force_insert=False, validate=True, clean=True,
308308
object_id = collection.insert(doc, **write_concern)
309309
else:
310310
object_id = collection.save(doc, **write_concern)
311-
# TODO: Pymongo 3.0 bug, fix scheduled for 3.0.1
312311
# In PyMongo 3.0, the save() call calls internally the _update() call
313312
# but they forget to return the _id value passed back, therefore getting it back here
313+
# Correct behaviour in 2.X and in 3.0.1+ versions
314314
if not object_id and pymongo.version_tuple == (3, 0):
315315
pk_as_mongo_obj = self._fields.get(self._meta['id_field']).to_mongo(self.pk)
316316
object_id = self._qs.filter(pk=pk_as_mongo_obj).first() and \

tests/document/indexes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ class BlogPost(Document):
513513
self.assertEqual(BlogPost.objects.count(), 10)
514514
self.assertEqual(BlogPost.objects.hint().count(), 10)
515515

516-
# PyMongo 3.0 bug
516+
# PyMongo 3.0 bug only, works correctly with 2.X and 3.0.1+ versions
517517
if pymongo.version != '3.0':
518518
self.assertEqual(BlogPost.objects.hint([('tags', 1)]).count(), 10)
519519

0 commit comments

Comments
 (0)