0

I’m using Paulmelnikow’s ObjCMongoDB to connect to a mongodb in my iOS. I want to load the data in chunks using MongoCursor. I need help to implement this.

Thanks.

Vakas
  • 6,291
  • 3
  • 35
  • 47

1 Answers1

0

You can just invoke -[MongoDBCollection cursorForFindAllWithError:], or one of the other methods which returns a cursor, and then iterate over it.

NSError *error = nil;

MongoCursor *cursor = [collection cursorForFindAllWithError:&error];

if (cursor) {
    for (BSONDocument *document in cursor) {
        // do something with document
    }
} else {
    NSLog(@"Error: %@", [error localizedDescription]);
}
paulmelnikow
  • 16,895
  • 8
  • 63
  • 114