Tag:Random sampling
-
The implementation of randomly obtaining one record in mongodb
The implementation principle is as follows 1. Query the total number of records in the table first 2. Random acquisition offset is 0 ~ total records – 1 3. When querying, get the skip offset and another record. Because my test environment PHP has been upgraded to above 7.0, mongodb extension supports php7.0 and above, […]