Ruby on rails 跳过和限制功能在rails rake文件中不起作用

Ruby on rails 跳过和限制功能在rails rake文件中不起作用,ruby-on-rails,mongodb,cursor,mongoose,Ruby On Rails,Mongodb,Cursor,Mongoose,你好,我是rails和mongodb的学习者。我正在使用mongodb作为后端在rails上运行应用程序。 我有大量的数据要在单个请求中检索,而我的错误是“游标错误”,因为我使用的技巧是将所有数据划分为小内容。在这个概念上,我有一个bug,我的代码是分开的 competitionsAry = NFL_Competition.where(sdi_sport_id: teamSdi_Sport_id) puts "Total competitions:" + competitionsA

你好,我是rails和mongodb的学习者。我正在使用mongodb作为后端在rails上运行应用程序。 我有大量的数据要在单个请求中检索,而我的错误是“游标错误”,因为我使用的技巧是将所有数据划分为小内容。在这个概念上,我有一个bug,我的代码是分开的

     competitionsAry = NFL_Competition.where(sdi_sport_id: teamSdi_Sport_id)

 puts "Total competitions:" + competitionsAry.count.to_s // it has 2330 count on this step  

      execCount = competitionsAry.count / 100

      if competitionsAry.count % 100 != 0

          execCount += 1

      end      

      execCount.times do |ctr|

        skipValue = ctr + 100

        competitions = competitionsAry.skip(skipValue).limit(100)

 puts "Now the competition length is: " + competitions.length.to_s // here also same amount of 2330 data
我知道“competitionsAry.skip(skipValue).limit(100)”这就是问题所在。
跳过和限制功能不起作用。甚至我也尝试过“competitions=NFL_Competition.skip(skipValue).limit(100)”没有结果,任何人都无法帮助解决这个问题,以及如何在rails上使用skip和limit函数。提前谢谢。

是的,我知道了,我在这里使用了ruby数组切片概念

competitions = competitionsAry[skipValue,100]