Subdoc API: is there a way to get "just a set of fields"

Hello!

Let’s suppose that i need to fetch dynamically-named fields (i don’t know their names, but can try to determine them, using some simple logic that i would like to be server-side-executed) from doc, for example:

{
“unique_incremented_id”:“value_1”,
“unique_incremented_id”:“value_2”,
“unique_incremented_id”:“value_3”,
… other fields
}

Is there a way to do that via Java API (or at all via raw server REST API, but not N1QL)?
Alternate question: is there a way to exclude fields with known names from subdoc-query-return ?

Can you model it such that they’re in an array? If so, then you’d be able to get just that path and retrieve all of the array. If you want to retrieve just the last N, that’d be doable with two sub-document operations.

I don’t think there is a way to exclude fields with the sub-document API. N1QL is more expressive and may have a way to do this.

I don’t know your full use case, but I suspect the best solution may be to use either N1QL or use some combination of sub-document and application code. Sub-document is implemented with a streaming parser in the core engine on the cluster side. We don’t want to add too much complexity there. Logic for filtering a list with such dynamic-ness may be better suited for the Java 8 streams APIs or some of the Guava functional APIs.

Hope that helps!

@ingenthr, thanks for recommendations :slight_smile:
In fact, after reading the docs i’ve performed a small re-modelling; this question was more about “maybe i just missed something”.