Fixed as_pymongo to return the id (#386)
This commit is contained in:
parent
4209d61b13
commit
f34e8a0ff6
3 changed files with 6 additions and 1 deletions
|
|
@ -3227,6 +3227,9 @@ class QuerySetTest(unittest.TestCase):
|
|||
User(name="Bob Dole", age=89, price=Decimal('1.11')).save()
|
||||
User(name="Barack Obama", age=51, price=Decimal('2.22')).save()
|
||||
|
||||
results = User.objects.only('id', 'name').as_pymongo()
|
||||
self.assertEqual(results[0].keys(), ['_id', 'name'])
|
||||
|
||||
users = User.objects.only('name', 'price').as_pymongo()
|
||||
results = list(users)
|
||||
self.assertTrue(isinstance(results[0], dict))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue