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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:22:53+00:00 2026-06-12T19:22:53+00:00

I am trying to implement a tailable cursor for mongo using C driver. Uptil

  • 0

I am trying to implement a tailable cursor for mongo using C driver. Uptil now i have been able to create it and successfully get the pushed data into my process with the following code

cursor =mongo_find( connection, DB_TENANT_NAMESPACE, query, bson_empty( &e ), 0, 0, MONGO_TAILABLE | MONGO_AWAIT_DATA);
while(1)
{
    while(mongo_cursor_next(cursor) == MONGO_OK)
    {
       b=mongo_cursor_bson(cursor);
      if(bson_find(iterator,b,"_id"))
      {
        oid =bson_iterator_oid(iterator);
        bson_oid_to_string(oid,&id);
        printf("ID:%s\n",id);
      }

}

With this code i can get the updates. But looking at the tailable cursors docs, it seems that i need to run the mongo_find inside the outer while loop to make sure i get the latest entries. The docs suggest appending to query with gte. Copying from docs

query = QUERY( "_id" << GT << lastId ).sort("$natural");

The issue is that the oid is an object which can be converted to a string. I dont really think i should be converting it to an int in-order for gte to work. Any ideas?

  • 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-12T19:22:54+00:00Added an answer on June 12, 2026 at 7:22 pm

    ObjectId’s may be logically compared by those operators, as can Date and Timestamp objects. There should be no need to represent the ObjectId as a string, and is no practical reason (at least in this case) for comparing an ObjectId to a string.

    Note that comparisons involving two different BSON types will follow this compare order.

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

Sidebar

Related Questions

Im trying to implement pagination using multiple searching criteria. Supposed I Have student table.
Trying to implement LoaderManager + CursorLoader. In onFinish method adapter should swap its cursor
I'm trying implement a bracket in my program (using C#/.NET MVC) and I am
Trying to implement AVAudioplayer and get some metering data of the played music, but
Trying to implement search with Sunspot Gem wich is using Solr.Fulltext search works fine
Trying to implement NSCopying for the first time, and I have a question about
I'm trying implement a way to recursively template using jsRender. The issue is, my
I have this weird kind of error. I am trying implement basic Euclidean algorithm
Trying to implement what I thought was a simple concept. I have a user
trying to implement a multiplayer. Using the sample from Game Center - Sending and

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.