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 8447969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:18:19+00:00 2026-06-10T10:18:19+00:00

I started using pymongo’s (version 2.2.1) ReplicaSetConnection object instead of the pymongo.Connection object. Now,

  • 0

I started using pymongo’s (version 2.2.1) ReplicaSetConnection object instead of the pymongo.Connection object. Now, when I perform reads from the database, like:

if cur.count() == 0:
    raise NoDocumentsFound(self.name, self.COLLECTION_NAME)
elif cur.count() > 1:
    raise TooManyDocumentsFound(self.name, self.COLLECTION_NAME)

cur.rewind()
rec = cur[0]

I sometimes receive an “IndexError: no such item for Cursor instance” on the final line. From all I can find out about this error, it should occur only when you don’t have any records that match your query. However, I’ve clearly already checked that my cursor has items in it. Is there something odd going on with the ReplicaSetConnection which makes these read operations more volatile?

  • 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-10T10:18:21+00:00Added an answer on June 10, 2026 at 10:18 am

    Oh, I’m an idiot. It turned out I had another thread running some test code at the same time. Therefore, there was a concurrent process which had modified the database in the span of time it took for me to examine the cursor and then pull the data out of it.

    This is an interesting example of how the cursor is lazy and that the cursor object itself is not just a simple array.

    Cheers,
    –Peter

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

Sidebar

Related Questions

I started using bundler (which is to my eyes a pure disaster). Now I
Started using thinking sphinx today and I'd like to know what's going wrong here:
I started using EF 4.1 code first. I have a entity table like this:
Started using omnifocus recently and really like it. I prefer gmail's web interface, so
Just started using Blueprint CSS and now playing with the grids but have a
I started using sass scss stylesheets. These generate *.css files from *.scss files. My
I started using Thrift about a week ago. I got the latest source from
I started using Foundation 3 from Zurb yesterday but the documentation they have provided
I started using POCO and have looked over the documentation of threads. From this,
Started using Visual Studio 2012 RC since yesterday, We have one WCF solution. Whenever

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.