使用no_cursor_timeout collection = self.db[tb_name] cols = collection.find(no_cursor_timeout=True) for col in cols: # do something cols.close()