Do you know mongo’s aggregation framework? Check it out, the key to high performance. As long as it is not cross-library or referenced, it can be used.
First create an index on the item, which can greatly improve the query speed. In addition, the random number conditions can be turned into specific query conditions (constructed with random numbers). In addition, the aggregation framework does not help with simple find queries like yours.
It is recommended to do it according to the specific query conditions when randomly obtaining it. Do not skip directly.
Do you know mongo’s aggregation framework? Check it out, the key to high performance. As long as it is not cross-library or referenced, it can be used.
First create an index on the item, which can greatly improve the query speed. In addition, the random number conditions can be turned into specific query conditions (constructed with random numbers). In addition, the aggregation framework does not help with simple find queries like yours.