Objective: In more than 100,000 dataRandomSelect a piece of data.
My method: data = db [item]. find (). skip (random _ num). limit ()
Problem encountered: It takes a long time to find data randomly. According to the profile test, it is because of find (). how to optimize?
It is suggested to do it according to the specific query conditions when randomly obtained. Don’t go directly through skip.