Skip to content

Instantly share code, notes, and snippets.

@AtnNn
Created March 30, 2016 15:16
Show Gist options
  • Save AtnNn/465776232240c8f5748a59f45102c23c to your computer and use it in GitHub Desktop.
Save AtnNn/465776232240c8f5748a59f45102c23c to your computer and use it in GitHub Desktop.
#include "rethinkdb.h"
int main() {
try {
std::unique_ptr<RethinkDB::Connection> conn = RethinkDB::connect("localhost", 28015);
RethinkDB::Cursor cursor = RethinkDB::table("leaderboard").order_by("score").limit(2).run(*conn);
for (auto score = cursor.begin(); score != cursor.end(); ++score) {
printf("datum: %s\n", RethinkDB::write_datum(*score).c_str());
}
} catch (RethinkDB::Error &err) {
printf("error: %s\n", err.message.c_str());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment