We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
append
put
We want to use a dot notation to populate a document and create the needed submaps as we go
Document doc = new Document(); doc.append("field1", "hello"); doc.append("metadata.key1", "value1"); doc.append("metadata.key2.key11", "value11"); System.out.println(doc.toJson());
Gets you a document without sub map definition
{"field1":"hello","metadata":{"key1":"value1","key2":{"key11":"value11"}}}
Sub map definitions are still possible:
Document doc = new Document(); doc.append("field1", "hello"); Map<String, String> map = new HashMap(); map.put("key11", "value11"); Map<String, Object> metadata = new HashMap(); map2.put("key1", "value1"); map2.put("key2", map); doc.append("metadata", metadata);
containKey
Dot notation is also working with containKey
Assertions.assertTrue(doc.containsKey("metadata.key2")); Assertions.assertTrue(doc.containsKey("metadata.key2.key11")); Assertions.assertFalse(doc.containsKey("metadata.key2.key12"));
remove
Dot notation is also working with remove
doc.remove("metadata.key2.key11"); Assertions.assertFalse(doc.containsKey("metadata.key2.key11")); System.out.println(doc.toJson());
Gets you
{"field1":"hello","metadata":{"key1":"value1","key2":{}}}
GET
API currently returning Documents and Rows but we would like with the Java Client to be table to retrieve nested data:
Documents
Rows
// Nested Maps myDocument.get("metadata.key1"); // Nested Arrays myDocument.get("metadata.keyArray[0]");
Implementations notes:
Collection<Document> ccc = getCollection(true); List<Document> animal = new ArrayList<>(); animal.add(new Document("1") .append("name", "Kittie") .append("metadata", Map.of("animal", "cat", "color", "black"))); animal.add(new Document("2") .append("name", "Lassie") .append("metadata", Map.of("animal", "dog", "breed", "Rough Collie", "color", "brown and white"))); animal.add(new Document("3") .append("name", "Dolly") .append("metadata", Map.of("animal", "sheep", "breed", "Finn-Dorset", "cloned", "yes"))); animal.add(new Document("4") .append("name", "Marjan") .append("metadata", Map.of("animal", "lion", "location", "Kabul Zoo", "fame", "war survivor"))); animal.add(new Document("5") .append("name", "Clever Hans") .append("metadata", Map.of("animal", "horse", "fame", "math abilities"))); animal.add(new Document("6") .append("name", "Paul") .append("metadata", Map.of("animal", "octopus", "fame", "World Cup predictions"))); animal.add(new Document("7") .append("name", "Hachiko") .append("metadata", Map.of("animal", "dog", "breed", "Akita", "fame", "loyalty"))); animal.add(new Document("8") .append("name", "Balto") .append("metadata", Map.of("animal", "dog", "breed", "Siberian Husky", "fame", "serum run hero"))); animal.add(new Document("9") .append("name", "Babe") .append("metadata", Map.of("animal", "pig", "fame", "movie star"))); animal.add(new Document("10") .append("name", "Togo") .append("metadata", Map.of("animal", "dog", "breed", "Siberian Husky", "fame", "real serum run hero"))); ccc.insertMany(animal); List<String> races = ccc.distinct("metadata.animal", String.class).all(); System.out.println(races);
gets you
[dog, cat, pig, horse, octopus, lion, sheep]
The text was updated successfully, but these errors were encountered:
No branches or pull requests
1. Building document with
append
orput
We want to use a dot notation to populate a document and create the needed submaps as we go
Gets you a document without sub map definition
Sub map definitions are still possible:
2. Check existence with
containKey
Dot notation is also working with
containKey
3.
remove
Dot notation is also working with
remove
Gets you
4. Accessing Document/Rows fields (
GET
) also use by distinctAPI currently returning
Documents
andRows
but we would like with the Java Client to be table to retrieve nested data:Implementations notes:
5. Sample applied to distinct
gets you
The text was updated successfully, but these errors were encountered: