(self)
| 1533 | self.assertEqual(db.test.estimated_document_count(), 2) |
| 1534 | |
| 1535 | def test_aggregate(self): |
| 1536 | db = self.db |
| 1537 | db.drop_collection("test") |
| 1538 | db.test.insert_one({"foo": [1, 2]}) |
| 1539 | |
| 1540 | with self.assertRaises(TypeError): |
| 1541 | db.test.aggregate("wow") # type: ignore[arg-type] |
| 1542 | |
| 1543 | pipeline = {"$project": {"_id": False, "foo": True}} |
| 1544 | result = db.test.aggregate([pipeline]) |
| 1545 | self.assertIsInstance(result, CommandCursor) |
| 1546 | self.assertEqual([{"foo": [1, 2]}], result.to_list()) |
| 1547 | |
| 1548 | # Test write concern. |
| 1549 | with self.write_concern_collection() as coll: |
| 1550 | coll.aggregate([{"$out": "output-collection"}]) |
| 1551 | |
| 1552 | def test_aggregate_raw_bson(self): |
| 1553 | db = self.db |
nothing calls this directly
no test coverage detected