使用no_cursor_timeout

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

转载于:https://www.cnblogs.com/dplearning/p/9577993.html

Logo

汇聚全球AI编程工具,助力开发者即刻编程。

更多推荐