Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (db.connect("devmoon.se"))
- {
- // add entry
- NestDB::Document entry;
- entry["name"] = "foo";
- entry["someVariable"] = 1337;
- db.add("nest.accounts", entry);
- // find entries where name = krisse
- NestDB::Document search;
- search["name"] = "krisse";
- NestDB::Result result = db.find("nest.accounts", search);
- // go trough the results
- while (result.next())
- {
- NestDB::Document doc(result);
- std::string id = doc["_id"]["$oid"].asString();
- std::string name = doc["name"].asString();
- std::cout << id << " " << name << std::endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement