MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / test_large_limit

Method test_large_limit

test/test_collection.py:1628–1643  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1626 try_invalid_session()
1627
1628 def test_large_limit(self):
1629 db = self.db
1630 db.drop_collection("test_large_limit")
1631 db.test_large_limit.create_index([("x", 1)])
1632 my_str = "mongomongo" * 1000
1633
1634 db.test_large_limit.insert_many({"x": i, "y": my_str} for i in range(2000))
1635
1636 i = 0
1637 y = 0
1638 for doc in db.test_large_limit.find(limit=1900).sort([("x", 1)]):
1639 i += 1
1640 y += doc["x"]
1641
1642 self.assertEqual(1900, i)
1643 self.assertEqual((1900 * 1899) / 2, y)
1644
1645 def test_find_kwargs(self):
1646 db = self.db

Callers

nothing calls this directly

Calls 5

drop_collectionMethod · 0.45
create_indexMethod · 0.45
insert_manyMethod · 0.45
sortMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected