Merge branch 'master' into Fix_update_full_result_documentation

This commit is contained in:
erdenezul
2019-02-18 09:31:00 +08:00
committed by GitHub
5 changed files with 171 additions and 77 deletions

View File

@@ -4641,8 +4641,6 @@ class QuerySetTest(unittest.TestCase):
self.assertEqual(doc_objects, Doc.objects.from_json(json_data))
def test_as_pymongo(self):
from decimal import Decimal
class LastLogin(EmbeddedDocument):
location = StringField()
ip = StringField()
@@ -4707,6 +4705,24 @@ class QuerySetTest(unittest.TestCase):
}
})
def test_as_pymongo_returns_cls_attribute_when_using_inheritance(self):
class User(Document):
name = StringField()
meta = {'allow_inheritance': True}
User.drop_collection()
user = User(name="Bob Dole").save()
result = User.objects.as_pymongo().first()
self.assertEqual(
result,
{
'_cls': 'User',
'_id': user.id,
'name': 'Bob Dole'
}
)
def test_as_pymongo_json_limit_fields(self):
class User(Document):