小程式云函式中用group分組查詢,只能查詢20條,怎么解決?
用滾動條每次加10加載,希望對您有幫助,
fetchNickYMCount: function() {
db.collection('findingList').aggregate()
.group({
_id: {
userName: '$userName',
writeYM: '$writeYM',
},
t: $.sum(1)
})
.sort({
_id:-1
})
.skip(this.data.s)
.limit(this.data.l)
.end()
.then(res => {
this.setData({
result: this.data.result.concat(res.list)
})
// console.log(this.data.result)
})
},
lower:function(){
this.setData({
s:this.data.s+10,
l:this.data.l+10
})
this.fetchNickYMCount()
},
WXML:
<scroll-view scroll-y="true" lower-threshold="100" bindscrolltolower="lower" style='height:878rpx;overflow-y: scroll;padding-top:1rpx;' >
<view class='history-table-wrap'>
<view >
<view >
<view >填寫人</view>
<view >填寫年月</view>
<view >共計</view>
</view>
<view wx:for="{{result}}" wx:key="{{index}}">
<view >{{item._id.userName}}</view>
<view >{{item._id.writeYM}}</view>
<view >{{item.t}}</view>
</view>
</view>
</view>
</scroll-view>
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/7541.html
標籤:其他
上一篇:Sql性能優化看這一篇就夠了
