Allow strings to be used in index creation #677

This commit is contained in:
Ross Lawley 2014-06-27 12:49:31 +01:00
parent 1bd83cc9bc
commit 94e177c0ef
3 changed files with 18 additions and 1 deletions

View File

@ -202,4 +202,5 @@ that much better:
* François Schmidts (https://github.com/jaesivsm) * François Schmidts (https://github.com/jaesivsm)
* Eric Plumb (https://github.com/professorplumb) * Eric Plumb (https://github.com/professorplumb)
* Damien Churchill (https://github.com/damoxc) * Damien Churchill (https://github.com/damoxc)
* Aleksandr Sorokoumov (https://github.com/Gerrrr) * Aleksandr Sorokoumov (https://github.com/Gerrrr)
* Clay McClure (https://github.com/claymation)

View File

@ -6,6 +6,7 @@ Changelog
Changes in 0.9.X - DEV Changes in 0.9.X - DEV
====================== ======================
- Allow strings to be used in index creation #675
- Fixed EmbeddedDoc weakref proxy issue #592 - Fixed EmbeddedDoc weakref proxy issue #592
- Fixed nested reference field distinct error #583 - Fixed nested reference field distinct error #583
- Fixed change tracking on nested MapFields #539 - Fixed change tracking on nested MapFields #539

View File

@ -727,5 +727,20 @@ class IndexesTest(unittest.TestCase):
report.to_mongo()) report.to_mongo())
self.assertEqual(report, Report.objects.get(pk=my_key)) self.assertEqual(report, Report.objects.get(pk=my_key))
def test_string_indexes(self):
class MyDoc(Document):
provider_ids = DictField()
meta = {
"indexes": ["provider_ids.foo", "provider_ids.bar"],
}
info = MyDoc.objects._collection.index_information()
info = [value['key'] for key, value in info.iteritems()]
self.assertTrue([('provider_ids.foo', 1)] in info)
self.assertTrue([('provider_ids.bar', 1)] in info)
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()