Skip to content

BaseDocument always returns empty properties #21

Closed
@caturner81

Description

@caturner81

Arango v2.6, Driver v2.5.6
So, I'm just getting started with ArangoDB so it could be that I'm missing something or it seems like your documentation on the ArangoDB website may be out of date, but the tutorial suggests the following code to fetch an entity and its properties :

DocumentEntity<BaseDocument> myDocument = null;
BaseDocument myObject2 = null;
try {
  myDocument = arangoDriver.getDocument(collectionName, "myKey", BaseDocument.class);
  myObject2 = myDocument.getEntity();
  System.out.println("Key: " + myObject2.getDocumentKey());
  System.out.println("Attribute 'a': " + myObject2.getProperties().get("a"));
  System.out.println("Attribute 'b': " + myObject2.getProperties().get("b"));
  System.out.println("Attribute 'c': " + myObject2.getProperties().get("c"));
} catch (ArangoException e) {
  System.out.println("Failed to get document. " + e.getMessage());
}

The readme for this project seems to show that you should use your own class rather than BaseDocument and count on the driver's deserialization, which seems ok, but I'd much rather have more fine grained control over my deserialization by accessing properties directly and handling nulls myself rather than getting back an object potentially chock full of null values for missing fields.

Is there some way to get BaseDocument to function as described in the code I pasted above? I've tried both like that and using the AQL and any time I use BaseDocument it returns an empty Map for properties. In any case, the tutorial should probably be updated because as a new user it's pretty frustrating when the "Java in 10 Minutes" tutorial leads to an hour of frustration because the code doesn't function as stated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions