What I'm trying to do: I have a list of Mongodb queries to go through, for each query, I would only need to get the data (with some filters that take some time) and dump it to a file on disk, so this should be mostly an I/O bound operation.
I'm sort of new to the threading and asyncio concept, from what I have read, the advantage of Asyncio over Threading is that, instead of relying on the OS/scheduler to check up on the thread (to see if they finished or not), it uses a single thread in a co-operative fashion which reduces the overhead of switching between threads. So from the look of it, using Motor with Asyncio should be the most optimal choice.
Although now I don't want to add another package install (Motor), I'm just wondering if using threading with Pymongo would even help in my case. I read Pymongo is a blocking driver, does that mean each thread would have to wait for the data fetching (I/O) to finish from Pymongo and then switch to another thread? Does this mean it would defeat the purpose of using threading?
The other question is, why can't I just use Asyncio with Pymongo but has to use Motor? e.g. put pymongo client find call inside an async function