Website | Source


Nitrite db = Nitrite.builder()
    .openOrCreate("user", "password");

// Create a Nitrite Collection
NitriteCollection collection = db.getCollection("test");

// create a document to populate data
Document doc = createDocument("firstName", "John")
     .put("lastName", "Doe")
     .put("birthDay", new Date())
     .put("data", new byte[] {1, 2, 3})
     .put("fruits", new ArrayList<String>() {{ add("apple"); add("orange"); }})
     .put("note", "a quick brown fox jump over the lazy dog");

// insert the document

// update the document
collection.update(eq("firstName", "John"), createDocument("lastName", "Wick"));


Tags: storage   embedded   jvm   document  

Last modified 14 April 2023