<input id="0qass"><u id="0qass"></u></input>
  • <input id="0qass"><u id="0qass"></u></input>
  • <menu id="0qass"><u id="0qass"></u></menu>

    小程序云函數中用group分組查詢,只能查詢20條,怎么解決?

    小程序云函數中用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" class="scoll-h" lower-threshold="100"  bindscrolltolower="lower" style='height:878rpx;overflow-y: scroll;padding-top:1rpx;' >
    
    <view class='history-table-wrap'>
    
    <view class="table">
    
    <view class="tr">
    
    <view class="th th1">填寫人</view>
    
    <view class="th th2">填寫年月</view>
    
    <view class="th th3">共計</view>
    
    </view>
    
    <view class="tr" wx:for="{{result}}"  wx:key="{{index}}">
    
    <view class="td td1">{{item._id.userName}}</view>
    
    <view class="td td2">{{item._id.writeYM}}</view>
    
    <view class="td td3">{{item.t}}</view>
    
    </view>
    
    </view>
    
    </view>
    
    </scroll-view>
    
    ??2020 CSDN 皮膚主題: 大白 設計師:CSDN官方博客 返回首頁
    多乐彩