(self)
| 418 | self.assertEqual(len(indexes), 0) |
| 419 | |
| 420 | def test_index_info(self): |
| 421 | db = self.db |
| 422 | db.test.drop() |
| 423 | db.test.insert_one({}) # create collection |
| 424 | self.assertEqual(len(db.test.index_information()), 1) |
| 425 | self.assertIn("_id_", db.test.index_information()) |
| 426 | |
| 427 | db.test.create_index("hello") |
| 428 | self.assertEqual(len(db.test.index_information()), 2) |
| 429 | self.assertEqual((db.test.index_information())["hello_1"]["key"], [("hello", ASCENDING)]) |
| 430 | |
| 431 | db.test.create_index([("hello", DESCENDING), ("world", ASCENDING)], unique=True) |
| 432 | self.assertEqual((db.test.index_information())["hello_1"]["key"], [("hello", ASCENDING)]) |
| 433 | self.assertEqual(len(db.test.index_information()), 3) |
| 434 | self.assertEqual( |
| 435 | [("hello", DESCENDING), ("world", ASCENDING)], |
| 436 | (db.test.index_information())["hello_-1_world_1"]["key"], |
| 437 | ) |
| 438 | self.assertEqual(True, (db.test.index_information())["hello_-1_world_1"]["unique"]) |
| 439 | |
| 440 | def test_index_geo2d(self): |
| 441 | db = self.db |
nothing calls this directly
no test coverage detected