直接上代码
const result = db.aggregate().sample({
size: 5
}).match({
is_show: true
}).end()
// size 每次随机的条数
// is_show 数据过滤条件,不需要的话直接match 去掉就行
// 具体方法说明可以参考官网说明
(完结)
下面是我的小程序,欢迎扫码支持
直接上代码
const result = db.aggregate().sample({
size: 5
}).match({
is_show: true
}).end()
// size 每次随机的条数
// is_show 数据过滤条件,不需要的话直接match 去掉就行
// 具体方法说明可以参考官网说明
(完结)
下面是我的小程序,欢迎扫码支持