Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9006721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:29:18+00:00 2026-06-16T01:29:18+00:00

I am fetching all the rows from the collection and experience delay on 100th

  • 0

I am fetching all the rows from the collection and experience delay on 100th row. I understand that find method returns cursor and not all the data up front and at certain point need to fetch more data. But the 100th row is the only delay.

Checking images 99
Checking image 100
*pause*
Checking image 101

And then with no visible delay up to 100 000 image.

Used ruby script:

require 'mongo'

time_start = Time.now

mongo = Mongo::MongoClient.new("localhost", 27017)

db = mongo["pics"]

images = db["images"]
albums = db["albums"]

orphans = []

images.find().each do |row|
    puts "Checking image #{row['_id']}"
end

# puts orphans
time_end = Time.now
puts "Total time taken: #{time_end - time_start}"

Used images collection (json)

mongoimport --db pics --collection images file_name

The questions are:

  • does some data come along with the initial cursor?
  • why is the only delay at 100th row? Maybe I’ve missed something but I don’t even see IO reads at that point

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T01:29:19+00:00Added an answer on June 16, 2026 at 1:29 am

    The default “batch size” of the MongoDB cursor is 100 objects. Means MongoDB fetches 100 objects before fetching the next batch…that is why you see delays. All drivers should provide a method “batch_size()” or similar on the cursor object for setting and retrieving the batch size.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What is Fetching rows with a scrollable cursor all about?
When fetching all rows from an Eloquent Model : $pin = Pin::all(); I get
I am fetching all records from a db table into a page using; SELECT
I'm fetching data from all 3 tables at once to avoid network latency. Fetching
Now a lot of scripts to facebook-style fetching data from url, but all of
Here's what I want to accomplish: Select all rows from table posts while also
I'm reading a book, where the author talks about fetching an row + all
I have two tables tracklist and song. I am fetching all values from song
Hello I have a problem with fetching required rows from MySQL table correctly within
So I have the following code for fetching all of my core data entities

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.