I am running one 'C' application with mongodb. Using mongo shell, I have found a way to retrieve last N records.
But I want to integrate same using C langauge code.
Edit
Using sort() and find() we may get the ascending or descending order data.
One way to limit the output for last N records is to use counter variable with cursor iteration. I am newbie to mongodb and not familiar with BSON objects.  
My question is, can I have a similar function for limit() in c language drivers of mongodb (instead of using counter kind of thing)?
 
     
    