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.
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.
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]);
}