I’ve been trying to iterate over every single document in my collection, but after the 101th the progress freezes and after about 30 seconds causes a bunch of errors to be thrown about a closed connection.
Future exception was never retrieved
future: <Future finished exception=ServerSelectionTimeoutError("cluster0-shard-00-00.8oorp.mongodb.net:27017: [WinError 10054] An existing connection was forcibly closed by the remote host,cluster0-shard-00-02.8oorp.mongodb.net:27017: [WinError 10054] An existing connection was forcibly closed by the remote host,cluster0-shard-00-01.8oorp.mongodb.net:27017: [WinError 10054] An existing connection was forcibly closed by the remote host, Timeout: 30s, Topology Description: <TopologyDescription id: 61ec2aa967debdfa1d0aa5e2, topology_type: ReplicaSetNoPrimary, servers: [<ServerDescription ('cluster0-shard-00-00.8oorp.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('cluster0-shard-00-00.8oorp.mongodb.net:27017: [WinError 10054] An existing connection was forcibly closed by the remote host')>, <ServerDescription ('cluster0-shard-00-01.8oorp.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('cluster0-shard-00-01.8oorp.mongodb.net:27017: [WinError 10054] An existing connection was forcibly closed by the remote host')>, <ServerDescription ('cluster0-shard-00-02.8oorp.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('cluster0-shard-00-02.8oorp.mongodb.net:27017: [WinError 10054] An existing connection was forcibly closed by the remote host')>]>")>
I’m just using a find with no parameters:
async for document in db.data.players.find({}):
Any way to either make the find function return more than 101 documents or to increase the timeout?
I’m using motor to interact with the mongo database.
Pardon me if I’m asking in the wrong place, please let me know where I should go to ask this question.