• 小程序云函数中用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>
    
  • 相关阅读:
    poj--2031--Building a Space Station(prime)
    nyoj--364--田忌赛马(贪心)
    nyoj--496--巡回赛(拓扑排序)
    nyoj--1100--WAJUEJI which home strong!(bfs)
    hdoj--5625--Clarke and chemistry(枚举)
    poj--1753--Flip Game(dfs好题)
    poj--1101--The Game(bfs)
    冒泡排序
    php常见错误
    php乱码
  • 原文地址:https://www.cnblogs.com/alannever/p/12689217.html
Copyright © 2020-2023  润新知