Home > Back-end >  How to efficiently use PyMongo cursor
How to efficiently use PyMongo cursor

Time:01-01

Please propose ways to access data returned from collections.find() in an efficient manner.

Is a for iteration the recommended way? How do I keep the character of a cursor being an Iterable?

Thx

CodePudding user response:

Briefly:

A cursor implements methods of Iterable and Iterator (after diving into the code of PyMongo's cursor.py). Thus, all the usual care working with iterators has to be taken.

  • Related