use of com.bluenimble.platform.db.Database in project serverless by bluenimble.
the class UpdateOne2One method main.
public static void main(String[] args) throws DatabaseException {
Database db = new DatabaseServer().get();
DatabaseObject driver = db.get("Drivers", "722388b0-9a9a-459e-a583-d802653a60b0");
driver.set("address", "Never Found");
DatabaseObject car = (DatabaseObject) driver.get("car");
car.set("model", "AlphaRomeo");
driver.save();
System.out.println();
System.out.println("+===============================================================================+");
System.out.println();
System.out.println(driver.toJson(new DefaultDatabaseObjectSerializer(2, 2)));
}
use of com.bluenimble.platform.db.Database in project serverless by bluenimble.
the class Describe method main.
public static void main(String[] args) throws DatabaseException {
Database db = new DatabaseServer().get();
System.out.println(db.describe());
}
use of com.bluenimble.platform.db.Database in project serverless by bluenimble.
the class Find method main.
public static void main(String[] args) throws DatabaseException {
Database db = new DatabaseServer().get();
final JsonArray records = new JsonArray();
JsonObject result = (JsonObject) new JsonObject().set("records", records);
db.find("Cities", new JsonQuery(new JsonObject()), new Database.Visitor() {
@Override
public boolean onRecord(DatabaseObject dbo) {
try {
dbo.set("org", "Labs");
dbo.save();
} catch (Exception ex) {
throw new RuntimeException(ex.getMessage(), ex);
}
records.add(dbo.toJson(null));
return false;
}
@Override
public boolean optimize() {
return true;
}
});
System.out.println(result);
}
use of com.bluenimble.platform.db.Database in project serverless by bluenimble.
the class FindOne method main.
public static void main(String[] args) throws DatabaseException {
Database db = new DatabaseServer().get();
DatabaseObject city = db.findOne("Cities", new JsonQuery(new JsonObject()));
System.out.println(city.toJson(new DefaultDatabaseObjectSerializer(2, 2)));
}
use of com.bluenimble.platform.db.Database in project serverless by bluenimble.
the class Get method main.
public static void main(String[] args) throws DatabaseException {
Database db = new DatabaseServer().get();
DatabaseObject employee = db.get("Employees", "3e6b5afe-166d-46cd-b6a9-66ec0bb581d4");
System.out.println(employee.toJson(new DefaultDatabaseObjectSerializer(2, 2)));
}
Aggregations