mongodb - Counting Documents in Mongo Cursor with C & BSON. -
i'm working on project , need count amount of documents (mongodb) in cursor bson , c.
here code:
bson_buffer_init(query_buf); bson_append_string(query_buf, "url", bson_iterator_string(it)); bson_from_buffer(query, query_buf); similar = mongo_find(conn, "testing.test", query, null, 0, 0, 0); while(mongo_cursor_next(similar)) { bson_iterator it2[1]; if(bson_find(it2, &similar->current, "url")) { printf("%s\n", bson_iterator_string(it2)); } }
how alter in order count documents in each cursor (the above in loop, url different each pass)?
have tried mongo_count
method?
according source, it's right here: https://github.com/mongodb/mongo-c-driver/blob/master/src/mongo.c#l385
note c drivers still considered alpha quality. if find bugs, please let mongodb team know: http://jira.mongodb.org/
Comments
Post a Comment